Forked from heat/jasmine.matcher.toBeInstanceOf.js
Last active
December 4, 2015 19:29
Star
You must be signed in to star a gist
Jasmine Matcher instanceof for Jasmine 2.3 & ES6
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
/* eslint-env jasmine */ | |
beforeEach(function() { | |
jasmine.addMatchers({ | |
toBeInstanceOf: (util, customEqualityTesters) => { | |
return { | |
compare: (actual, expected) => { | |
const pass = (actual instanceof expected); | |
return { | |
pass, | |
message: `Expected ${actual} to ${pass ? 'not' : ''} be instance of ${expected}`, | |
}; | |
}, | |
}; | |
}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've found that, at least for immutable.js
Records
, use ofexpect(myObj).toBe(jasmine.any(MyRecord))
doesn't seem to work but this does.