From 26ff87450ef1810641db3f65398a00285c77093f Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 22:16:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Update=20`useAsyncState?= =?UTF-8?q?`=20test=20to=20handle=20operation=20cancellation=20with=20abor?= =?UTF-8?q?t=20signal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/unit/composables/useAsyncState.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/websites/pokedex.online/tests/unit/composables/useAsyncState.test.js b/code/websites/pokedex.online/tests/unit/composables/useAsyncState.test.js index 9cc24d7..8f2a5ed 100644 --- a/code/websites/pokedex.online/tests/unit/composables/useAsyncState.test.js +++ b/code/websites/pokedex.online/tests/unit/composables/useAsyncState.test.js @@ -164,8 +164,9 @@ describe('useAsyncState', () => { it('should cancel ongoing operation when reset', async () => { const { execute, reset, loading } = useAsyncState(); - const asyncFn = vi.fn(async () => { + const asyncFn = vi.fn(async (signal) => { await new Promise(resolve => setTimeout(resolve, 100)); + if (signal?.aborted) throw new Error('Aborted'); return 'Success'; });