From 3907d1c28f87ec35fc1b764aa5d61651240c8277 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 4 Aug 2022 17:28:42 +0100 Subject: [PATCH] Fix output after test finished (#2564) * Fix output after test finished As per comment * Add more flushes --- spec/unit/queueToDevice.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/unit/queueToDevice.spec.ts b/spec/unit/queueToDevice.spec.ts index ff22d29d4..02c39bb1c 100644 --- a/spec/unit/queueToDevice.spec.ts +++ b/spec/unit/queueToDevice.spec.ts @@ -114,6 +114,10 @@ describe.each([ }); await httpBackend.flushAllExpected(); + // let the code handle the response to the request so we don't get + // log output after the test has finished (apparently stopping the + // client in aftereach is not sufficient.) + await flushPromises(); }); it("retries on error", async function() { @@ -141,6 +145,9 @@ describe.each([ await flushAndRunTimersUntil(() => httpBackend.requests.length > 0); expect(httpBackend.flushSync(null, 1)).toEqual(1); + + // flush, as per comment in first test + await flushPromises(); }); it("stops retrying on 4xx errors", async function() { @@ -334,5 +341,8 @@ describe.each([ await client.queueToDevice(batch); await httpBackend.flushAllExpected(); + + // flush, as per comment in first test + await flushPromises(); }); });