Skip to content

Instantly share code, notes, and snippets.

@roine
Created December 3, 2014 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roine/fc2d2da1d7bf090d3d61 to your computer and use it in GitHub Desktop.
Save roine/fc2d2da1d7bf090d3d61 to your computer and use it in GitHub Desktop.
Jasmine matchers
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