Skip to content

Instantly share code, notes, and snippets.

@avshabanov
Created August 7, 2015 06:21
Show Gist options
  • Save avshabanov/36daf62552404aae2b83 to your computer and use it in GitHub Desktop.
Save avshabanov/36daf62552404aae2b83 to your computer and use it in GitHub Desktop.
Testing rsvp Promises in Jest
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