🛠️ Update useAsyncState test to handle operation cancellation with abort signal

This commit is contained in:
2026-01-28 22:16:33 +00:00
parent c91843d828
commit 26ff87450e

View File

@@ -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';
});