Skip to content

Commit

Permalink
Remove time-sensitive CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Aug 16, 2022
1 parent c887f6c commit 48f52e0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
21 changes: 14 additions & 7 deletions packages/toolkit/src/query/core/buildThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,26 +356,33 @@ export function buildThunks<
let catchedError = error
if (catchedError instanceof HandledError) {
let transformErrorResponse: (
baseQueryReturnValue: any,
meta: any,
arg: any
baseQueryReturnValue: any,
meta: any,
arg: any
) => any = defaultTransformResponse

if (endpointDefinition.query && endpointDefinition.transformErrorResponse) {
if (
endpointDefinition.query &&
endpointDefinition.transformErrorResponse
) {
transformErrorResponse = endpointDefinition.transformErrorResponse
}
try {
return rejectWithValue(
await transformErrorResponse(catchedError.value, catchedError.meta, arg.originalArgs),
{ baseQueryMeta: catchedError.meta }
await transformErrorResponse(
catchedError.value,
catchedError.meta,
arg.originalArgs
),
{ baseQueryMeta: catchedError.meta }
)
} catch (e) {
catchedError = e
}
}
if (
typeof process !== 'undefined' &&
process.env.NODE_ENV === 'development'
process.env.NODE_ENV !== 'production'
) {
console.error(
`An unhandled error occurred processing a request for the endpoint "${arg.endpointName}".
Expand Down
9 changes: 0 additions & 9 deletions packages/toolkit/src/query/tests/cleanup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ test('Minimizes the number of subscription dispatches when multiple components a
return <>{listItems}</>
}

const start = Date.now()

render(<ParentComponent />, {
wrapper: storeRef.wrapper,
})
Expand All @@ -189,10 +187,6 @@ test('Minimizes the number of subscription dispatches when multiple components a
return screen.getAllByText(/42/).length > 0
})

const end = Date.now()

const timeElapsed = end - start

const subscriptions = getSubscriptionsA()

expect(Object.keys(subscriptions!).length).toBe(NUM_LIST_ITEMS)
Expand All @@ -203,7 +197,4 @@ test('Minimizes the number of subscription dispatches when multiple components a
// 'api/executeQuery/fulfilled'
// ]
expect(actionTypes.length).toBe(4)
// Could be flaky in CI, but we'll see.
// Currently seeing 1000ms in local dev, 6300 without the batching fixes
expect(timeElapsed).toBeLessThan(2500)
}, 25000)
7 changes: 5 additions & 2 deletions packages/toolkit/src/query/tests/devWarnings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ In the case of an unhandled error, no tags will be "provided" or "invalidated".
return { error: {} }
},
endpoints: (build) => ({
transformErRspn: build.query<any, void>({
query() {},
// @ts-ignore TS doesn't like `() => never` for `tER`
transformErRspn: build.query<number, void>({
// @ts-ignore TS doesn't like `() => never` for `tER`
query: () => '/dummy',
// @ts-ignore TS doesn't like `() => never` for `tER`
transformErrorResponse() {
throw new Error('this was kinda expected')
},
Expand Down

0 comments on commit 48f52e0

Please sign in to comment.