Skip to content

Commit e9dfc93

Browse files
committed
fix test
1 parent 6277952 commit e9dfc93

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/toolkit/src/tests/actionCreatorInvariantMiddleware.test.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { ActionCreatorInvariantMiddlewareOptions } from '@internal/actionCreatorInvariantMiddleware'
22
import { getMessage } from '@internal/actionCreatorInvariantMiddleware'
33
import { createActionCreatorInvariantMiddleware } from '@internal/actionCreatorInvariantMiddleware'
4-
import type { Dispatch, MiddlewareAPI } from '@reduxjs/toolkit'
4+
import type { MiddlewareAPI } from '@reduxjs/toolkit'
55
import { createAction } from '@reduxjs/toolkit'
66

77
describe('createActionCreatorInvariantMiddleware', () => {
8-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
8+
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
99

1010
afterEach(() => {
1111
consoleSpy.mockClear()
@@ -17,17 +17,14 @@ describe('createActionCreatorInvariantMiddleware', () => {
1717
const dummyAction = createAction('aSlice/anAction')
1818

1919
it('sends the action through the middleware chain', () => {
20-
const next: Dispatch = (action) => ({
21-
...action,
22-
returned: true,
23-
})
20+
const next = vi.fn()
2421
const dispatch = createActionCreatorInvariantMiddleware()(
2522
{} as MiddlewareAPI
2623
)(next)
24+
dispatch({ type: 'SOME_ACTION' })
2725

28-
expect(dispatch(dummyAction())).toEqual({
29-
...dummyAction(),
30-
returned: true,
26+
expect(next).toHaveBeenCalledWith({
27+
type: 'SOME_ACTION',
3128
})
3229
})
3330

0 commit comments

Comments
 (0)