From 0541b7f3c5d023995554633bc5ea69cf199eebad Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 11 Jun 2021 11:36:33 -0600 Subject: [PATCH] Remove a layer of indirection --- spec/unit/utils.spec.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/spec/unit/utils.spec.ts b/spec/unit/utils.spec.ts index 4a1a60f8e..cd0f43823 100644 --- a/spec/unit/utils.spec.ts +++ b/spec/unit/utils.spec.ts @@ -251,20 +251,15 @@ describe("utils", function() { it("should execute promises in chunks", async function() { let promiseCount = 0; - function fn1() { - return (async function() { - await utils.sleep(1); - expect(promiseCount).toEqual(0); - ++promiseCount; - })(); + async function fn1() { + await utils.sleep(1); + expect(promiseCount).toEqual(0); + ++promiseCount; } - function fn2() { - return new Promise(function(resolve, reject) { - expect(promiseCount).toEqual(1); - ++promiseCount; - resolve(null); - }); + async function fn2() { + expect(promiseCount).toEqual(1); + ++promiseCount; } await utils.chunkPromises([fn1, fn2], 1);