Skip to content

Instantly share code, notes, and snippets.

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 dathi/0de66fc0e00f263ca40ce5d18d53e8d6 to your computer and use it in GitHub Desktop.
Save dathi/0de66fc0e00f263ca40ce5d18d53e8d6 to your computer and use it in GitHub Desktop.
Jasmine Matcher instanceof
beforeEach(function() {
this.addMatchers({
toBeInstanceOf: function(expectedInstance) {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
this.message = function() {
return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name;
};
return actual instanceof expectedInstance;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment