Skip to content

Instantly share code, notes, and snippets.

@joeeames
Created October 9, 2017 13:45
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 joeeames/1e604a78daa36cee6e26915051c64276 to your computer and use it in GitHub Desktop.
Save joeeames/1e604a78daa36cee6e26915051c64276 to your computer and use it in GitHub Desktop.
hero matcher
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