Skip to content

Commit

Permalink
Fix arguments type
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Oct 14, 2024
1 parent 1918f13 commit 41487fd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,20 @@ describe('fetchBaseQuery', () => {
const prepare = vitest.fn()
const baseQuery = fetchBaseQuery<{ foo?: string; bar?: number }>({
prepareHeaders(headers, api) {
expectTypeOf(api.extraOptions).toEqualTypeOf<{ foo?: string; bar?: number }>()
prepare.apply(undefined, arguments)
expectTypeOf(api.extraOptions).toEqualTypeOf<{
foo?: string
bar?: number
}>()
prepare.apply(undefined, arguments as unknown as any[])
},
})
baseQuery('http://example.com', commonBaseQueryApi, { foo: 'baz', bar: 5 })
baseQuery('http://example.com', commonBaseQueryApi, {
foo: 'baz',
bar: 5,
})
expect(prepare).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({ extraOptions: { foo: 'baz', bar: 5 } })
expect.objectContaining({ extraOptions: { foo: 'baz', bar: 5 } }),
)

// ensure types
Expand Down

0 comments on commit 41487fd

Please sign in to comment.