Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenz Weber committed Nov 12, 2021
1 parent a3d120b commit 50cf1ef
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/apiProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { waitMs } from './helpers'
const api = createApi({
baseQuery: async (arg: any) => {
await waitMs()
return { data: arg?.body ? arg.body : undefined }
return { data: arg?.body ? arg.body : null }
},
endpoints: (build) => ({
getUser: build.query<any, number>({
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/buildThunks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test('passes the extraArgument property to the baseQueryApi', async () => {

describe('re-triggering behavior on arg change', () => {
const api = createApi({
baseQuery: () => ({ data: undefined }),
baseQuery: () => ({ data: null }),
endpoints: (build) => ({
getUser: build.query<any, any>({
query: (obj) => obj,
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/cleanup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { render, waitFor } from '@testing-library/react'
import { setupApiStore } from './helpers'

const api = createApi({
baseQuery: () => ({ data: undefined }),
baseQuery: () => ({ data: null }),
endpoints: (build) => ({
a: build.query<unknown, void>({ query: () => '' }),
b: build.query<unknown, void>({ query: () => '' }),
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/createApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('wrong tagTypes log errors', () => {
})

beforeEach(() => {
baseQuery.mockResolvedValue({})
baseQuery.mockResolvedValue({ data: 'foo' })
})

test.each<[keyof typeof api.endpoints, boolean?]>([
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('fetchBaseQuery', () => {
expect(res).toBeInstanceOf(Object)
expect(res.meta?.request).toBeInstanceOf(Request)
expect(res.meta?.response).toBeInstanceOf(Object)
expect(res.data).toBeUndefined()
expect(res.data).toBeNull()
})

it('should return an error and status for error responses', async () => {
Expand Down

0 comments on commit 50cf1ef

Please sign in to comment.