🛠️ Update useAsyncState test to handle operation cancellation with abort signal
This commit is contained in:
@@ -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';
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user