Created
December 3, 2014 19:27
-
-
Save roine/fc2d2da1d7bf090d3d61 to your computer and use it in GitHub Desktop.
Jasmine matchers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var matchers = { | |
toBePromise: function(util){ | |
return { | |
compare: function(actual){ | |
var result = {} | |
result.pass = typeof actual === "object" && typeof actual.then === "function"; | |
if(result.pass){ | |
result.message = "Expected var not be a Promise"; | |
} | |
else{ | |
result.message = 'Expected var to be a Promise'; | |
} | |
return result; | |
} | |
}; | |
} | |
}; | |
jasmine.addMatchers(matchers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment