Skip to content

Commit d194a55

Browse files
committed
Change .toHaveBeenCalledTimes(0) to .not.toHaveBeenCalled()
1 parent 9470fe2 commit d194a55

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/toolkit/src/query/tests/cacheLifecycle.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ test('updateCachedData', async () => {
505505
draft.value = 'TEST'
506506
trackCalls()
507507
})
508-
expect(trackCalls).toHaveBeenCalledTimes(0)
508+
expect(trackCalls).not.toHaveBeenCalled()
509509
expect(getCacheEntry().data).toEqual(undefined)
510510

511511
gotFirstValue(await cacheDataLoaded)
@@ -612,7 +612,7 @@ test('dispatching a mutation initializer with `track: false` does not start a li
612612
await storeRef.store.dispatch(
613613
extended.endpoints.injected.initiate(undefined, { track: false }),
614614
)
615-
expect(onNewCacheEntry).toHaveBeenCalledTimes(0)
615+
expect(onNewCacheEntry).not.toHaveBeenCalled()
616616

617617
await storeRef.store.dispatch(extended.endpoints.injected.initiate(undefined))
618618
expect(onNewCacheEntry).toHaveBeenCalledOnce()

packages/toolkit/src/query/tests/createApi.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ describe('custom serializeQueryArgs per endpoint', () => {
10161016
api.endpoints.queryWithNoSerializer.initiate(99),
10171017
)
10181018

1019-
expect(serializer1).toHaveBeenCalledTimes(0)
1019+
expect(serializer1).not.toHaveBeenCalled()
10201020

10211021
await storeRef.store.dispatch(
10221022
api.endpoints.queryWithCustomSerializer.initiate(42),
@@ -1045,7 +1045,7 @@ describe('custom serializeQueryArgs per endpoint', () => {
10451045
})
10461046

10471047
it('Works via injectEndpoints', async () => {
1048-
expect(serializer2).toHaveBeenCalledTimes(0)
1048+
expect(serializer2).not.toHaveBeenCalled()
10491049

10501050
await storeRef.store.dispatch(
10511051
injectedApi.endpoints.injectedQueryWithCustomSerializer.initiate(5),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ describe('conditional skipping of asyncThunks', () => {
607607
const condition = () => Promise.resolve(false)
608608
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition })
609609
await asyncThunk(arg)(dispatch, getState, extra)
610-
expect(dispatch).toHaveBeenCalledTimes(0)
610+
expect(dispatch).not.toHaveBeenCalled()
611611
})
612612

613613
test('async condition with rejected promise', async () => {
@@ -632,14 +632,14 @@ describe('conditional skipping of asyncThunks', () => {
632632
thunkPromise.abort()
633633
await thunkPromise
634634
} catch (err) {}
635-
expect(dispatch).toHaveBeenCalledTimes(0)
635+
expect(dispatch).not.toHaveBeenCalled()
636636
})
637637

638638
test('rejected action is not dispatched by default', async () => {
639639
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition })
640640
await asyncThunk(arg)(dispatch, getState, extra)
641641

642-
expect(dispatch).toHaveBeenCalledTimes(0)
642+
expect(dispatch).not.toHaveBeenCalled()
643643
})
644644

645645
test('does not fail when attempting to abort a canceled promise', async () => {

0 commit comments

Comments
 (0)