@@ -35,11 +35,7 @@ import { server } from './mocks/server'
3535import type { UnknownAction } from 'redux'
3636import type { SubscriptionOptions } from '@reduxjs/toolkit/dist/query/core/apiState'
3737import type { SerializedError } from '@reduxjs/toolkit'
38- import {
39- createListenerMiddleware ,
40- configureStore ,
41- createSlice ,
42- } from '@reduxjs/toolkit'
38+ import { createListenerMiddleware , configureStore , createSlice } from '@reduxjs/toolkit'
4339import { delay } from '../../utils'
4440import type { SubscriptionSelectors } from '../core/buildMiddleware/types'
4541import { countObjectKeys } from '../utils/countObjectKeys'
@@ -1483,7 +1479,7 @@ describe('hooks tests', () => {
14831479
14841480 userEvent . hover ( screen . getByTestId ( 'highPriority' ) )
14851481 expect (
1486- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1482+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
14871483 ) . toEqual ( {
14881484 data : { name : 'Timmy' } ,
14891485 endpointName : 'getUser' ,
@@ -1504,7 +1500,7 @@ describe('hooks tests', () => {
15041500 )
15051501
15061502 expect (
1507- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1503+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
15081504 ) . toEqual ( {
15091505 data : { name : 'Timmy' } ,
15101506 endpointName : 'getUser' ,
@@ -1552,7 +1548,7 @@ describe('hooks tests', () => {
15521548 userEvent . hover ( screen . getByTestId ( 'lowPriority' ) )
15531549
15541550 expect (
1555- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1551+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
15561552 ) . toEqual ( {
15571553 data : { name : 'Timmy' } ,
15581554 endpointName : 'getUser' ,
@@ -1570,7 +1566,7 @@ describe('hooks tests', () => {
15701566 await waitMs ( )
15711567
15721568 expect (
1573- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1569+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
15741570 ) . toEqual ( {
15751571 data : { name : 'Timmy' } ,
15761572 endpointName : 'getUser' ,
@@ -1620,7 +1616,7 @@ describe('hooks tests', () => {
16201616 // This should run the query being that we're past the threshold
16211617 userEvent . hover ( screen . getByTestId ( 'lowPriority' ) )
16221618 expect (
1623- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1619+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
16241620 ) . toEqual ( {
16251621 data : { name : 'Timmy' } ,
16261622 endpointName : 'getUser' ,
@@ -1640,7 +1636,7 @@ describe('hooks tests', () => {
16401636 )
16411637
16421638 expect (
1643- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1639+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
16441640 ) . toEqual ( {
16451641 data : { name : 'Timmy' } ,
16461642 endpointName : 'getUser' ,
@@ -1687,13 +1683,13 @@ describe('hooks tests', () => {
16871683
16881684 // Get a snapshot of the last result
16891685 const latestQueryData = api . endpoints . getUser . select ( USER_ID ) (
1690- storeRef . store . getState ( )
1686+ storeRef . store . getState ( ) as any
16911687 )
16921688
16931689 userEvent . hover ( screen . getByTestId ( 'lowPriority' ) )
16941690 // Serve up the result from the cache being that the condition wasn't met
16951691 expect (
1696- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1692+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
16971693 ) . toEqual ( latestQueryData )
16981694 } )
16991695
@@ -1721,7 +1717,7 @@ describe('hooks tests', () => {
17211717 userEvent . hover ( screen . getByTestId ( 'lowPriority' ) )
17221718
17231719 expect (
1724- api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) )
1720+ api . endpoints . getUser . select ( USER_ID ) ( storeRef . store . getState ( ) as any )
17251721 ) . toEqual ( {
17261722 endpointName : 'getUser' ,
17271723 isError : false ,
@@ -2057,13 +2053,13 @@ describe('hooks with createApi defaults set', () => {
20572053 } )
20582054
20592055 const counterSlice = createSlice ( {
2060- name : ' counter' ,
2056+ name : " counter" ,
20612057 initialState : { count : 0 } ,
20622058 reducers : {
20632059 increment ( state ) {
20642060 state . count ++
2065- } ,
2066- } ,
2061+ }
2062+ }
20672063 } )
20682064
20692065 const storeRef = setupApiStore ( api , {
@@ -2357,9 +2353,7 @@ describe('hooks with createApi defaults set', () => {
23572353 return (
23582354 < div
23592355 data-testid = "incrementButton"
2360- onClick = { ( ) =>
2361- storeRef . store . dispatch ( counterSlice . actions . increment ( ) )
2362- }
2356+ onClick = { ( ) => storeRef . store . dispatch ( counterSlice . actions . increment ( ) ) }
23632357 >
23642358 Increment Count
23652359 </ div >
0 commit comments