Created
October 9, 2017 13:45
-
-
Save joeeames/1e604a78daa36cee6e26915051c64276 to your computer and use it in GitHub Desktop.
hero matcher
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
beforeEach(() => { | |
jasmine.addMatchers({ | |
toBeAHero: (util, customEqualityMatchers) => { | |
return { | |
compare: (actual, expected) => { | |
return { | |
// heroes are objects that have id, name and strength properties | |
pass: actual && actual.id && actual.name && actual.strength | |
}; | |
} | |
}; | |
} | |
}); | |
}); | |
declare module jasmine { | |
interface Matchers { | |
toBeAHero(): boolean; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment