Skip to content

Commit e18c7a3

Browse files
committed
Remove satisfies operators in queryFn.test.tsx
1 parent 2ff8533 commit e18c7a3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

packages/toolkit/src/query/tests/queryFn.test.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ describe('queryFn base implementation tests', () => {
244244

245245
const thunk = endpoint.initiate(endpointName)
246246

247-
const result = (await store.dispatch(thunk)) satisfies
247+
const result:
248248
| undefined
249249
| { data: string }
250-
| { error: string | SerializedError }
250+
| { error: string | SerializedError } = await store.dispatch(thunk)
251251

252252
if (endpointName.includes('Throw')) {
253253
expect(consoleErrorSpy).toHaveBeenCalledOnce()
@@ -291,7 +291,7 @@ describe('queryFn base implementation tests', () => {
291291
{
292292
const thunk = withNeither.initiate('withNeither')
293293

294-
const result = (await store.dispatch(thunk)) satisfies QuerySubState<any>
294+
const result: QuerySubState<any> = await store.dispatch(thunk)
295295

296296
expect(consoleErrorSpy).toHaveBeenCalledOnce()
297297

@@ -311,10 +311,10 @@ describe('queryFn base implementation tests', () => {
311311
{
312312
const thunk = mutationWithNeither.initiate('mutationWithNeither')
313313

314-
const result = (await store.dispatch(thunk)) satisfies
314+
const result:
315315
| undefined
316316
| { data: string }
317-
| { error: string | SerializedError }
317+
| { error: string | SerializedError } = await store.dispatch(thunk)
318318

319319
expect(consoleErrorSpy).toHaveBeenCalledOnce()
320320

@@ -323,6 +323,10 @@ describe('queryFn base implementation tests', () => {
323323
TypeError('endpointDefinition.queryFn is not a function'),
324324
)
325325

326+
if (!('error' in result)) {
327+
expect.fail()
328+
}
329+
326330
expect(result.error).toEqual(
327331
expect.objectContaining({
328332
message: 'endpointDefinition.queryFn is not a function',
@@ -417,9 +421,9 @@ describe('usage scenario tests', () => {
417421
it('can wrap a service like Firebase and handle errors', async () => {
418422
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(noop)
419423

420-
const result = (await storeRef.store.dispatch(
424+
const result: QuerySubState<any> = await storeRef.store.dispatch(
421425
api.endpoints.getMissingFirebaseUser.initiate(1),
422-
)) satisfies QuerySubState<any>
426+
)
423427

424428
expect(consoleErrorSpy).toHaveBeenCalledOnce()
425429

0 commit comments

Comments
 (0)