Skip to content

Commit

Permalink
Test assertion.shift with an async assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Mar 25, 2015
1 parent 3ae444a commit 2f2ba2a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/unexpected.spec.js
Expand Up @@ -4434,6 +4434,31 @@ describe('unexpected', function () {
});
});

describe('assertion.shift', function () {
describe('with an async assertion', function () {
var clonedExpect = expect.clone().addAssertion('when delayed a little bit', function (expect, subject) {
var that = this;
return expect.promise(function (run) {
setTimeout(run(function () {
return that.shift(expect, subject, 0);
}), 1);
});
});

it('should succeed', function () {
return clonedExpect(42, 'when delayed a little bit', 'to be a number');
});

it('should fail with a diff', function () {
return expect(
clonedExpect(false, 'when delayed a little bit', 'to be a number'),
'to be rejected',
'expected false when delayed a little bit to be a number'
);
});
});
});

describe('async', function () {
before(function () {
expect = expect.clone()
Expand Down

0 comments on commit 2f2ba2a

Please sign in to comment.