diff --git a/test/chainAsync.test.js b/test/chainAsync.test.js index 857f77035..2349f1a52 100644 --- a/test/chainAsync.test.js +++ b/test/chainAsync.test.js @@ -5,7 +5,7 @@ test('chainAsync is a Function', () => { }); let incrementer = 0; -test('Calls all functions in an array', () => { +test('Calls all functions in an array', done => { chainAsync([ next => { incrementer += 1; @@ -17,17 +17,19 @@ test('Calls all functions in an array', () => { }, next => { expect(incrementer).toEqual(2); + done(); } ]); }); -test('Last function does not receive "next" argument', () => { +test('Last function does not receive "next" argument', done => { chainAsync([ next => { next(); }, next => { expect(next).toBe(undefined); + done(); } ]); }); diff --git a/test/collectInto.test.js b/test/collectInto.test.js index 6c7ef705e..dd4dc87e3 100644 --- a/test/collectInto.test.js +++ b/test/collectInto.test.js @@ -8,10 +8,5 @@ let p1 = Promise.resolve(1); let p2 = Promise.resolve(2); let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); test('Works with multiple promises', () => { - Pall(p1, p2, p3).then( - function(val) { - expect(val).toBe([1, 2, 3]); - }, - function(reason) {} - ); + return expect(Pall(p1, p2, p3)).resolves.toEqual([1, 2, 3]); }); diff --git a/test/debounce.test.js b/test/debounce.test.js index da370976a..7310d9584 100644 --- a/test/debounce.test.js +++ b/test/debounce.test.js @@ -3,8 +3,10 @@ const {debounce} = require('./_30s.js'); test('debounce is a Function', () => { expect(debounce).toBeInstanceOf(Function); }); -test('Works as expected', () => { - debounce(() => { +test('Works as expected', done => { + const debouncedFn = debounce(() => { expect(true).toBeTruthy(); + done(); }); + debouncedFn(); }); diff --git a/test/delay.test.js b/test/delay.test.js index b809b11ff..b14785c52 100644 --- a/test/delay.test.js +++ b/test/delay.test.js @@ -3,10 +3,11 @@ const {delay} = require('./_30s.js'); test('delay is a Function', () => { expect(delay).toBeInstanceOf(Function); }); -test('Works as expecting, passing arguments properly', () => { +test('Works as expecting, passing arguments properly', done => { delay( function(text) { expect(text).toBe('test'); + done(); }, 1000, 'test' diff --git a/test/hashNode.test.js b/test/hashNode.test.js index 1950b5f47..16bb514e5 100644 --- a/test/hashNode.test.js +++ b/test/hashNode.test.js @@ -3,8 +3,10 @@ const {hashNode} = require('./_30s.js'); test('hashNode is a Function', () => { expect(hashNode).toBeInstanceOf(Function); }); -test('Produces the appropriate hash', () => { - hashNode(JSON.stringify({ a: 'a', b: [1, 2, 3, 4], foo: { c: 'bar' } })).then(v => - expect(v).toBe('04aa106279f5977f59f9067fa9712afc4aedc6f5862a8defc34552d8c7206393') +test("Produces the appropriate hash", () => { + expect( + hashNode(JSON.stringify({ a: "a", b: [1, 2, 3, 4], foo: { c: "bar" } })) + ).resolves.toBe( + "04aa106279f5977f59f9067fa9712afc4aedc6f5862a8defc34552d8c7206393" ); }); diff --git a/test/runPromisesInSeries.test.js b/test/runPromisesInSeries.test.js index 151dd9b66..73ddfd155 100644 --- a/test/runPromisesInSeries.test.js +++ b/test/runPromisesInSeries.test.js @@ -5,5 +5,7 @@ test('runPromisesInSeries is a Function', () => { }); const delay = d => new Promise(r => setTimeout(r, d)); test('Runs promises in series', () => { - runPromisesInSeries([() => delay(100), () => delay(200).then(() => expect(true).toBeTruthy())]); + return runPromisesInSeries([() => delay(100), () => delay(200)]).then(() => + expect(true).toBeTruthy() + ); }); diff --git a/test/sleep.test.js b/test/sleep.test.js index 4b9beb634..32e3cff00 100644 --- a/test/sleep.test.js +++ b/test/sleep.test.js @@ -4,8 +4,5 @@ test('sleep is a Function', () => { expect(sleep).toBeInstanceOf(Function); }); test('Works as expected', () => { - async function sleepyWork() { - await sleep(1000); - expect(true).toBeTruthy(); - } + return expect(sleep(1000)).resolves.toBe(undefined); });