From 20b1ddc2f9bbabd6f5c9e6976983db3b3e9359a5 Mon Sep 17 00:00:00 2001 From: Rebecca Meritz Date: Wed, 10 Jun 2020 12:44:14 -0700 Subject: [PATCH] Ensure that promises are correctly tested By returning the result https://jestjs.io/docs/en/expect.html#resolves --- test/callback_to_promise.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/callback_to_promise.test.js b/test/callback_to_promise.test.js index b98c6686..3a4754b4 100644 --- a/test/callback_to_promise.test.js +++ b/test/callback_to_promise.test.js @@ -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) { @@ -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); }); });