Skip to content

Commit cd6a274

Browse files
test(vue-query/vueQueryPlugin): rename 'testIf' helper to 'itIf' for consistency with 'it' convention (TanStack#10533)
* test(vue-query/vueQueryPlugin): rename 'testIf' helper to 'itIf' for consistency with 'it' convention * ci: apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent fc0462b commit cd6a274

File tree

2 files changed

+39
-45
lines changed

2 files changed

+39
-45
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default [
5959
'vitest/no-standalone-expect': [
6060
'error',
6161
{
62-
additionalTestBlockFunctions: ['testIf'],
62+
additionalTestBlockFunctions: ['itIf'],
6363
},
6464
],
6565
},

packages/vue-query/src/__tests__/vueQueryPlugin.test.ts

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface TestApp extends App {
2424
$root: TestApp
2525
}
2626

27-
const testIf = (condition: boolean) => (condition ? it : it.skip)
27+
const itIf = (condition: boolean) => (condition ? it : it.skip)
2828

2929
function getAppMock(withUnmountHook = false): TestApp {
3030
const mock = {
@@ -61,7 +61,7 @@ describe('VueQueryPlugin', () => {
6161
expect(setupDevtoolsMock).toHaveBeenCalledTimes(0)
6262
})
6363

64-
testIf(isVue2)('should NOT setup devtools by default', () => {
64+
itIf(isVue2)('should NOT setup devtools by default', () => {
6565
const envCopy = process.env.NODE_ENV
6666
process.env.NODE_ENV = 'development'
6767
const setupDevtoolsMock = setupDevtools as Mock
@@ -75,7 +75,7 @@ describe('VueQueryPlugin', () => {
7575
expect(setupDevtoolsMock).toHaveBeenCalledTimes(0)
7676
})
7777

78-
testIf(isVue2)('should setup devtools', () => {
78+
itIf(isVue2)('should setup devtools', () => {
7979
const envCopy = process.env.NODE_ENV
8080
process.env.NODE_ENV = 'development'
8181
const setupDevtoolsMock = setupDevtools as Mock
@@ -89,7 +89,7 @@ describe('VueQueryPlugin', () => {
8989
expect(setupDevtoolsMock).toHaveBeenCalledTimes(1)
9090
})
9191

92-
testIf(isVue3)('should NOT setup devtools by default', () => {
92+
itIf(isVue3)('should NOT setup devtools by default', () => {
9393
const envCopy = process.env.NODE_ENV
9494
process.env.NODE_ENV = 'development'
9595
const setupDevtoolsMock = setupDevtools as Mock
@@ -100,7 +100,7 @@ describe('VueQueryPlugin', () => {
100100
expect(setupDevtoolsMock).toHaveBeenCalledTimes(0)
101101
})
102102

103-
testIf(isVue3)('should setup devtools', () => {
103+
itIf(isVue3)('should setup devtools', () => {
104104
const envCopy = process.env.NODE_ENV
105105
process.env.NODE_ENV = 'development'
106106
const setupDevtoolsMock = setupDevtools as Mock
@@ -148,7 +148,7 @@ describe('VueQueryPlugin', () => {
148148
})
149149

150150
describe('when called without additional options', () => {
151-
testIf(isVue2)('should provide a client with default clientKey', () => {
151+
itIf(isVue2)('should provide a client with default clientKey', () => {
152152
const appMock = getAppMock()
153153
VueQueryPlugin.install(appMock)
154154

@@ -159,7 +159,7 @@ describe('VueQueryPlugin', () => {
159159
})
160160
})
161161

162-
testIf(isVue3)('should provide a client with default clientKey', () => {
162+
itIf(isVue3)('should provide a client with default clientKey', () => {
163163
const appMock = getAppMock()
164164
VueQueryPlugin.install(appMock)
165165

@@ -171,7 +171,7 @@ describe('VueQueryPlugin', () => {
171171
})
172172

173173
describe('when called with custom clientKey', () => {
174-
testIf(isVue2)('should provide a client with customized clientKey', () => {
174+
itIf(isVue2)('should provide a client with customized clientKey', () => {
175175
const appMock = getAppMock()
176176
VueQueryPlugin.install(appMock, { queryClientKey: 'CUSTOM' })
177177

@@ -182,7 +182,7 @@ describe('VueQueryPlugin', () => {
182182
})
183183
})
184184

185-
testIf(isVue3)('should provide a client with customized clientKey', () => {
185+
itIf(isVue3)('should provide a client with customized clientKey', () => {
186186
const appMock = getAppMock()
187187
VueQueryPlugin.install(appMock, { queryClientKey: 'CUSTOM' })
188188

@@ -194,7 +194,7 @@ describe('VueQueryPlugin', () => {
194194
})
195195

196196
describe('when called with custom client', () => {
197-
testIf(isVue2)('should provide that custom client', () => {
197+
itIf(isVue2)('should provide that custom client', () => {
198198
const appMock = getAppMock()
199199
const customClient = { mount: vi.fn() } as unknown as QueryClient
200200
VueQueryPlugin.install(appMock, { queryClient: customClient })
@@ -207,7 +207,7 @@ describe('VueQueryPlugin', () => {
207207
})
208208
})
209209

210-
testIf(isVue3)('should provide that custom client', () => {
210+
itIf(isVue3)('should provide that custom client', () => {
211211
const appMock = getAppMock()
212212
const customClient = { mount: vi.fn() } as unknown as QueryClient
213213
VueQueryPlugin.install(appMock, { queryClient: customClient })
@@ -221,42 +221,36 @@ describe('VueQueryPlugin', () => {
221221
})
222222

223223
describe('when called with custom client config', () => {
224-
testIf(isVue2)(
225-
'should instantiate a client with the provided config',
226-
() => {
227-
const appMock = getAppMock()
228-
const config = {
229-
defaultOptions: { queries: { enabled: true } },
230-
}
231-
VueQueryPlugin.install(appMock, {
232-
queryClientConfig: config,
233-
})
224+
itIf(isVue2)('should instantiate a client with the provided config', () => {
225+
const appMock = getAppMock()
226+
const config = {
227+
defaultOptions: { queries: { enabled: true } },
228+
}
229+
VueQueryPlugin.install(appMock, {
230+
queryClientConfig: config,
231+
})
234232

235-
appMock._mixin.beforeCreate?.call(appMock)
236-
const client = appMock._provided.VUE_QUERY_CLIENT as QueryClient
237-
const defaultOptions = client.getDefaultOptions()
238-
239-
expect(defaultOptions).toEqual(config.defaultOptions)
240-
},
241-
)
242-
243-
testIf(isVue3)(
244-
'should instantiate a client with the provided config',
245-
() => {
246-
const appMock = getAppMock()
247-
const config = {
248-
defaultOptions: { queries: { enabled: true } },
249-
}
250-
VueQueryPlugin.install(appMock, {
251-
queryClientConfig: config,
252-
})
233+
appMock._mixin.beforeCreate?.call(appMock)
234+
const client = appMock._provided.VUE_QUERY_CLIENT as QueryClient
235+
const defaultOptions = client.getDefaultOptions()
253236

254-
const client = (appMock.provide as Mock).mock.calls[0]?.[1]
255-
const defaultOptions = client.getDefaultOptions()
237+
expect(defaultOptions).toEqual(config.defaultOptions)
238+
})
256239

257-
expect(defaultOptions).toEqual(config.defaultOptions)
258-
},
259-
)
240+
itIf(isVue3)('should instantiate a client with the provided config', () => {
241+
const appMock = getAppMock()
242+
const config = {
243+
defaultOptions: { queries: { enabled: true } },
244+
}
245+
VueQueryPlugin.install(appMock, {
246+
queryClientConfig: config,
247+
})
248+
249+
const client = (appMock.provide as Mock).mock.calls[0]?.[1]
250+
const defaultOptions = client.getDefaultOptions()
251+
252+
expect(defaultOptions).toEqual(config.defaultOptions)
253+
})
260254
})
261255

262256
describe('when persister is provided', () => {

0 commit comments

Comments
 (0)