Skip to content

Instantly share code, notes, and snippets.

@ppraksa
Created July 25, 2019 12:37
Show Gist options
  • Save ppraksa/312604d0c35b90b9b985f5e7b658afbe to your computer and use it in GitHub Desktop.
Save ppraksa/312604d0c35b90b9b985f5e7b658afbe to your computer and use it in GitHub Desktop.
// jasmine
const customMatchers = {
toBeArray: function () {
return {
compare: function (item) {
const result = {
pass: item instanceof Array,
message: ''
};
if(result.pass) {
result.message = item + ' is instance of Array';
} else {
result.message = item + ' is not instance of Array';
}
return result
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment