File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 4
4
QueryCache ,
5
5
QueryClient ,
6
6
QueryFunction ,
7
- QueryFunctionContext ,
8
7
QueryObserver ,
9
8
MutationObserver ,
10
9
} from '../..'
@@ -173,13 +172,13 @@ describe('queryClient', () => {
173
172
expect ( goodDefaults ) . toBe ( defaultsOfABCD )
174
173
expect ( consoleWarnMock ) . toHaveBeenCalledTimes ( 1 )
175
174
176
- // Let's reset the defaults query options and change the order of registration
177
- queryClient . queryDefaults . length = 0
175
+ // Let's create another queryClient and change the order of registration
176
+ const newQueryClient = new QueryClient ( )
178
177
// The defaults for key ABC (more generic) are registered **before** the ones of key ABCD…
179
- queryClient . setQueryDefaults ( keyABC , defaultsOfABC )
180
- queryClient . setQueryDefaults ( keyABCD , defaultsOfABCD )
178
+ newQueryClient . setQueryDefaults ( keyABC , defaultsOfABC )
179
+ newQueryClient . setQueryDefaults ( keyABCD , defaultsOfABCD )
181
180
// … then the "wrong" defaults are retrieved: we get the ones for key "ABC"
182
- const badDefaults = queryClient . getQueryDefaults ( keyABCD )
181
+ const badDefaults = newQueryClient . getQueryDefaults ( keyABCD )
183
182
expect ( badDefaults ) . not . toBe ( defaultsOfABCD )
184
183
expect ( badDefaults ) . toBe ( defaultsOfABC )
185
184
expect ( consoleWarnMock ) . toHaveBeenCalledTimes ( 2 )
You can’t perform that action at this time.
0 commit comments