Skip to content

Commit

Permalink
Ensure that promises are correctly tested
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeritz committed Jun 11, 2020
1 parent 54c8d88 commit 20b1ddc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/callback_to_promise.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ describe('callbackToPromise', function() {

it('lets a function return a promise that can resolve', function() {
var wrapped = callbackToPromise(returnThisPlusValue, 1);
expect(wrapped(2)).resolves.toBe(3);
return expect(wrapped(2)).resolves.toBe(3);
});

it('lets a function return a promise that can reject', function() {
var wrapped = callbackToPromise(rejectValue, 1);
expect(wrapped(2)).rejects.toThrow(/reject this value/);
return expect(wrapped(2)).rejects.toThrow(/reject this value/);
});

it('maintains the ability to call a function with a callback', function(done) {
Expand Down Expand Up @@ -59,6 +59,6 @@ describe('callbackToPromise', function() {

it('can allow the user to explicately identify the index of the callback', function() {
var wrapped = callbackToPromise(returnThisPlusValue, 1, 1);
expect(wrapped(2)).resolves.toBe(3);
return expect(wrapped(2)).resolves.toBe(3);
});
});

0 comments on commit 20b1ddc

Please sign in to comment.