Last active
March 7, 2016 22:00
-
-
Save deckar01/6d2b339ec273212508c4 to your computer and use it in GitHub Desktop.
Failed attempt at promise matchers wrapper for jasmine 2
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(function () { | |
jasmine.Matchers = {prototype: {}}; | |
jasmine.Env = {prototype: {}}; | |
require('promise-matchers'); | |
Object.keys(jasmine.Matchers.prototype).forEach(function(key) { | |
var matcher = jasmine.Matchers.prototype[key]; | |
jasmine.Matchers.prototype[key] = function() { | |
return { | |
compare: function(actual, done, expected) { | |
actual.toString = function() { return 'Promise'; }; | |
var self = { | |
actual: actual, | |
env: jasmine.Env.prototype | |
}; | |
return { | |
pass: matcher.call(self, done, expected) | |
}; | |
} | |
} | |
} | |
}); | |
jasmine.addMatchers(jasmine.Matchers.prototype); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment