From c258231c8f12e2cb759e358542d01595b577fb54 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Fri, 17 May 2024 15:57:52 +0200 Subject: [PATCH] test: update async tests --- test/index.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/index.test.ts b/test/index.test.ts index f617527..901b126 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -434,10 +434,12 @@ test('async', async () => { expect(spy.called).toBe(true) expect(spy.results[0][1]).toBeInstanceOf(Promise) + expect(spy.results[0][1]).toBe(promise) const count = await promise - expect(spy.results).toEqual([['ok', 1]]) + expect(spy.results[0][0]).toBe('ok') + expect(spy.results[0][1]).toBe(promise) expect(count).toBe(1) }) @@ -461,8 +463,8 @@ test('async error', async () => { caughtError = e } - expect(spy.results[0][0]).toEqual('error') - expect(spy.results[0][1].message).toEqual('async error') + expect(spy.results[0][0]).toEqual('ok') + expect(spy.results[0][1]).toBe(promise) expect(caughtError).toBeInstanceOf(Error) expect(caughtError?.message).toEqual('async error') })