Skip to content

Commit

Permalink
Add test for cAT.withTypes() runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Nov 9, 2022
1 parent 3f78f9d commit 9b1acb3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/toolkit/src/tests/createAsyncThunk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,4 +953,18 @@ describe('meta', () => {
ret.meta.extraProp
}
})

test('typed createAsyncThunk.withTypes', () => {
const typedCAT = createAsyncThunk.withTypes<{
state: { s: string }
rejectValue: string
extra: { s: string; n: number }
}>()
const thunk = typedCAT('a', () => 'b')
const expectFunction = expect.any(Function)
expect(thunk.fulfilled).toEqual(expectFunction)
expect(thunk.pending).toEqual(expectFunction)
expect(thunk.rejected).toEqual(expectFunction)
expect(thunk.fulfilled.type).toBe('a/fulfilled')
})
})

0 comments on commit 9b1acb3

Please sign in to comment.