1+ import { noop } from '@internal/listenerMiddleware/utils'
2+ import type { PayloadAction } from '@reduxjs/toolkit'
13import {
24 configureStore ,
35 createAction ,
6+ createListenerMiddleware ,
47 createSlice ,
58 isAnyOf ,
9+ TaskAbortError ,
610} from '@reduxjs/toolkit'
7- import { vi } from 'vitest'
8-
9- import type { PayloadAction } from '@reduxjs/toolkit'
10-
11- import { createListenerMiddleware , TaskAbortError } from '../index'
12-
13- import type { TypedAddListener } from '../index'
1411
1512describe ( 'Saga-style Effects Scenarios' , ( ) => {
1613 interface CounterState {
@@ -57,10 +54,7 @@ describe('Saga-style Effects Scenarios', () => {
5754 return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) )
5855 }
5956
60- beforeAll ( ( ) => {
61- const noop = ( ) => { }
62- vi . spyOn ( console , 'error' ) . mockImplementation ( noop )
63- } )
57+ const consoleErrorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( noop )
6458
6559 beforeEach ( ( ) => {
6660 listenerMiddleware = createListenerMiddleware < CounterState > ( )
@@ -72,6 +66,14 @@ describe('Saga-style Effects Scenarios', () => {
7266 } )
7367 } )
7468
69+ afterEach ( ( ) => {
70+ consoleErrorSpy . mockClear ( )
71+ } )
72+
73+ afterAll ( ( ) => {
74+ consoleErrorSpy . mockRestore ( )
75+ } )
76+
7577 test ( 'throttle' , async ( ) => {
7678 // Ignore incoming actions for a given period of time while processing a task.
7779 // Ref: https://redux-saga.js.org/docs/api#throttlems-pattern-saga-args
0 commit comments