Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Failed attempt at promise matchers wrapper for jasmine 2
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