Created
March 16, 2014 21:27
-
-
Save mokkabonna/9590191 to your computer and use it in GitHub Desktop.
promises for expect.js
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
var eventually = { | |
expect: function(promise) { | |
function notBe(expectedValue) { | |
return promise.then(function(eventualValue) { | |
expect(eventualValue).not.to.be(expectedValue); | |
}); | |
} | |
function be(expectedValue) { | |
return promise.then(function(eventualValue) { | |
expect(eventualValue).to.be(expectedValue); | |
}); | |
} | |
var exp = { | |
to: { | |
be: be | |
}, | |
not: { | |
to: { | |
be: notBe | |
} | |
} | |
}; | |
return exp; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment