Created
August 7, 2015 06:21
-
-
Save avshabanov/36daf62552404aae2b83 to your computer and use it in GitHub Desktop.
Testing rsvp Promises in Jest
This file contains hidden or 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
it('should check promise', function () { | |
// Given: | |
var rsvp = require('rsvp'); | |
var holder = {val: 0}; | |
// When: | |
var promise = new rsvp.Promise(function (resolve) { resolve(1); }); | |
promise.then(function (d) { holder.val = d; }); | |
// Then: | |
expect(holder.val).toBe(0); | |
jest.runAllTimers(); | |
expect(holder.val).toBe(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment