Skip to content

Commit 012d323

Browse files
authored
test(svelte-query): unify all test descriptions with 'should' (#10453)
1 parent 6040278 commit 012d323

File tree

8 files changed

+46
-46
lines changed

8 files changed

+46
-46
lines changed

packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('QueryClientProvider', () => {
1616
vi.useRealTimers()
1717
})
1818

19-
test('Sets a specific cache for all queries to use', async () => {
19+
test('should set a specific cache for all queries to use', async () => {
2020
const queryCache = queryClient.getQueryCache()
2121

2222
const rendered = render(BaseExample, {

packages/svelte-query/tests/context/context.svelte.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { getIsRestoringContext } from '../../src/index.js'
44
import BaseExample from './BaseExample.svelte'
55

66
describe('getQueryClientContext', () => {
7-
test('Throw when called without a client in context', () => {
7+
test('should throw when called without a client in context', () => {
88
expect(() => render(BaseExample)).toThrow(
99
'No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?',
1010
)
1111
})
1212
})
1313

1414
describe('getIsRestoringContext', () => {
15-
test('Do not throw when called outside of a component', () => {
15+
test('should not throw when called outside of a component', () => {
1616
expect(() => getIsRestoringContext()).not.toThrow()
1717
})
1818
})

packages/svelte-query/tests/createMutation/createMutation.svelte.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('createMutation', () => {
2222
vi.useRealTimers()
2323
})
2424

25-
test('Able to reset `error`', async () => {
25+
test('should be able to reset `error`', async () => {
2626
const rendered = render(ResetExample, {
2727
props: { queryClient },
2828
})
@@ -38,7 +38,7 @@ describe('createMutation', () => {
3838
expect(rendered.getByText('Error: undefined')).toBeInTheDocument()
3939
})
4040

41-
test('Able to call `onSuccess` and `onSettled` after each successful mutate', async () => {
41+
test('should be able to call `onSuccess` and `onSettled` after each successful mutate', async () => {
4242
const onSuccessMock = vi.fn()
4343
const onSettledMock = vi.fn()
4444

@@ -69,7 +69,7 @@ describe('createMutation', () => {
6969
expect(onSettledMock).toHaveBeenNthCalledWith(3, 3)
7070
})
7171

72-
test('Set correct values for `failureReason` and `failureCount` on multiple mutate calls', async () => {
72+
test('should set correct values for `failureReason` and `failureCount` on multiple mutate calls', async () => {
7373
type Value = { count: number }
7474

7575
const mutationFn = vi.fn<(value: Value) => Promise<Value>>()

packages/svelte-query/tests/createQueries/createQueries.test-d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('createQueries', () => {
4343
>()
4444
})
4545

46-
it('handles type parameter - tuple of tuples', () => {
46+
it('should handle type parameter - tuple of tuples', () => {
4747
const queryClient = new QueryClient()
4848
const key1 = queryKey()
4949
const key2 = queryKey()
@@ -158,7 +158,7 @@ describe('createQueries', () => {
158158
)
159159
})
160160

161-
it('handles type parameter - tuple of objects', () => {
161+
it('should handle type parameter - tuple of objects', () => {
162162
const queryClient = new QueryClient()
163163
const key1 = queryKey()
164164
const key2 = queryKey()
@@ -315,7 +315,7 @@ describe('createQueries', () => {
315315
)
316316
})
317317

318-
it('handles array literal without type parameter to infer result type', () => {
318+
it('should handle array literal without type parameter to infer result type', () => {
319319
const queryClient = new QueryClient()
320320
const key1 = queryKey()
321321
const key2 = queryKey()
@@ -562,7 +562,7 @@ describe('createQueries', () => {
562562
)
563563
})
564564

565-
it('handles strongly typed queryFn factories and createQueries wrappers', () => {
565+
it('should handle strongly typed queryFn factories and createQueries wrappers', () => {
566566
const queryClient = new QueryClient()
567567

568568
// QueryKey + queryFn factory

packages/svelte-query/tests/infiniteQueryOptions.test-d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createInfiniteQuery, infiniteQueryOptions } from '../src/index.js'
55
import type { InfiniteData } from '@tanstack/query-core'
66

77
describe('infiniteQueryOptions', () => {
8-
test('Should not allow excess properties', () => {
8+
test('should not allow excess properties', () => {
99
const key = queryKey()
1010
assertType(
1111
infiniteQueryOptions({
@@ -19,7 +19,7 @@ describe('infiniteQueryOptions', () => {
1919
)
2020
})
2121

22-
test('Should infer types for callbacks', () => {
22+
test('should infer types for callbacks', () => {
2323
const key = queryKey()
2424
infiniteQueryOptions({
2525
queryKey: key,
@@ -33,7 +33,7 @@ describe('infiniteQueryOptions', () => {
3333
})
3434
})
3535

36-
test('Should work when passed to createInfiniteQuery', () => {
36+
test('should work when passed to createInfiniteQuery', () => {
3737
const key = queryKey()
3838
const options = infiniteQueryOptions({
3939
queryKey: key,
@@ -50,7 +50,7 @@ describe('infiniteQueryOptions', () => {
5050
>()
5151
})
5252

53-
test('Should work when passed to fetchInfiniteQuery', async () => {
53+
test('should work when passed to fetchInfiniteQuery', async () => {
5454
const key = queryKey()
5555
const options = infiniteQueryOptions({
5656
queryKey: key,

packages/svelte-query/tests/mutationOptions/mutationOptions.test-d.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {
1919
} from '../../src/types.js'
2020

2121
describe('mutationOptions', () => {
22-
test('Should not allow excess properties', () => {
22+
test('should not allow excess properties', () => {
2323
const key = queryKey()
2424

2525
// @ts-expect-error this is a good error, because onMutates does not exist!
@@ -33,7 +33,7 @@ describe('mutationOptions', () => {
3333
})
3434
})
3535

36-
test('Should infer types for callbacks', () => {
36+
test('should infer types for callbacks', () => {
3737
const key = queryKey()
3838

3939
mutationOptions({
@@ -45,7 +45,7 @@ describe('mutationOptions', () => {
4545
})
4646
})
4747

48-
test('Should infer types for onError callback', () => {
48+
test('should infer types for onError callback', () => {
4949
const key = queryKey()
5050

5151
mutationOptions({
@@ -59,7 +59,7 @@ describe('mutationOptions', () => {
5959
})
6060
})
6161

62-
test('Should infer types for variables', () => {
62+
test('should infer types for variables', () => {
6363
const key = queryKey()
6464

6565
mutationOptions<number, DefaultError, { id: string }>({
@@ -71,7 +71,7 @@ describe('mutationOptions', () => {
7171
})
7272
})
7373

74-
test('Should infer result type correctly', () => {
74+
test('should infer result type correctly', () => {
7575
const key = queryKey()
7676

7777
mutationOptions<number, DefaultError, void, { name: string }>({
@@ -86,7 +86,7 @@ describe('mutationOptions', () => {
8686
})
8787
})
8888

89-
test('Should infer context type correctly', () => {
89+
test('should infer context type correctly', () => {
9090
const key = queryKey()
9191

9292
mutationOptions<number>({
@@ -110,7 +110,7 @@ describe('mutationOptions', () => {
110110
})
111111
})
112112

113-
test('Should error if mutationFn return type mismatches TData', () => {
113+
test('should error if mutationFn return type mismatches TData', () => {
114114
assertType(
115115
mutationOptions<number>({
116116
// @ts-expect-error this is a good error, because return type is string, not number
@@ -119,7 +119,7 @@ describe('mutationOptions', () => {
119119
)
120120
})
121121

122-
test('Should allow mutationKey to be omitted', () => {
122+
test('should allow mutationKey to be omitted', () => {
123123
return mutationOptions({
124124
mutationFn: () => Promise.resolve(123),
125125
onSuccess: (data) => {
@@ -128,7 +128,7 @@ describe('mutationOptions', () => {
128128
})
129129
})
130130

131-
test('Should infer all types when not explicitly provided', () => {
131+
test('should infer all types when not explicitly provided', () => {
132132
const key = queryKey()
133133

134134
expectTypeOf(
@@ -157,7 +157,7 @@ describe('mutationOptions', () => {
157157
>()
158158
})
159159

160-
test('Should work when used with createMutation', () => {
160+
test('should work when used with createMutation', () => {
161161
const key = queryKey()
162162

163163
const mutation = createMutation(() =>
@@ -184,7 +184,7 @@ describe('mutationOptions', () => {
184184
)
185185
})
186186

187-
test('Should work when used with useIsMutating', () => {
187+
test('should work when used with useIsMutating', () => {
188188
const key = queryKey()
189189

190190
const isMutating = useIsMutating(
@@ -203,7 +203,7 @@ describe('mutationOptions', () => {
203203
)
204204
})
205205

206-
test('Should work when used with queryClient.isMutating', () => {
206+
test('should work when used with queryClient.isMutating', () => {
207207
const key = queryKey()
208208
const queryClient = new QueryClient()
209209

@@ -223,7 +223,7 @@ describe('mutationOptions', () => {
223223
)
224224
})
225225

226-
test('Should work when used with useMutationState', () => {
226+
test('should work when used with useMutationState', () => {
227227
const key = queryKey()
228228

229229
const mutationState = useMutationState({

packages/svelte-query/tests/queryOptions.test-d.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { createQueries, queryOptions } from '../src/index.js'
1010
import type { QueryObserverResult } from '@tanstack/query-core'
1111

1212
describe('queryOptions', () => {
13-
test('Should not allow excess properties', () => {
13+
test('should not allow excess properties', () => {
1414
const key = queryKey()
1515
assertType(
1616
queryOptions({
@@ -22,7 +22,7 @@ describe('queryOptions', () => {
2222
)
2323
})
2424

25-
test('Should infer types for callbacks', () => {
25+
test('should infer types for callbacks', () => {
2626
const key = queryKey()
2727
queryOptions({
2828
queryKey: key,
@@ -34,7 +34,7 @@ describe('queryOptions', () => {
3434
})
3535
})
3636

37-
test('Should work when passed to fetchQuery', async () => {
37+
test('should work when passed to fetchQuery', async () => {
3838
const key = queryKey()
3939
const options = queryOptions({
4040
queryKey: key,
@@ -45,7 +45,7 @@ describe('queryOptions', () => {
4545
expectTypeOf(data).toEqualTypeOf<number>()
4646
})
4747

48-
test('Should work when passed to createQueries', () => {
48+
test('should work when passed to createQueries', () => {
4949
const key = queryKey()
5050
const options = queryOptions({
5151
queryKey: key,
@@ -59,7 +59,7 @@ describe('queryOptions', () => {
5959
expectTypeOf(queries[0].data).toEqualTypeOf<number | undefined>()
6060
})
6161

62-
test('Should tag the queryKey with the result type of the QueryFn', () => {
62+
test('should tag the queryKey with the result type of the QueryFn', () => {
6363
const key = queryKey()
6464
const { queryKey: tagged } = queryOptions({
6565
queryKey: key,
@@ -69,7 +69,7 @@ describe('queryOptions', () => {
6969
expectTypeOf(tagged[dataTagSymbol]).toEqualTypeOf<number>()
7070
})
7171

72-
test('Should tag the queryKey even if no promise is returned', () => {
72+
test('should tag the queryKey even if no promise is returned', () => {
7373
const key = queryKey()
7474
const { queryKey: tagged } = queryOptions({
7575
queryKey: key,
@@ -79,7 +79,7 @@ describe('queryOptions', () => {
7979
expectTypeOf(tagged[dataTagSymbol]).toEqualTypeOf<number>()
8080
})
8181

82-
test('Should tag the queryKey with unknown if there is no queryFn', () => {
82+
test('should tag the queryKey with unknown if there is no queryFn', () => {
8383
const key = queryKey()
8484
const { queryKey: tagged } = queryOptions({
8585
queryKey: key,
@@ -88,7 +88,7 @@ describe('queryOptions', () => {
8888
expectTypeOf(tagged[dataTagSymbol]).toEqualTypeOf<unknown>()
8989
})
9090

91-
test('Should tag the queryKey with the result type of the QueryFn if select is used', () => {
91+
test('should tag the queryKey with the result type of the QueryFn if select is used', () => {
9292
const key = queryKey()
9393
const { queryKey: tagged } = queryOptions({
9494
queryKey: key,
@@ -99,7 +99,7 @@ describe('queryOptions', () => {
9999
expectTypeOf(tagged[dataTagSymbol]).toEqualTypeOf<number>()
100100
})
101101

102-
test('Should return the proper type when passed to getQueryData', () => {
102+
test('should return the proper type when passed to getQueryData', () => {
103103
const key = queryKey()
104104
const { queryKey: tagged } = queryOptions({
105105
queryKey: key,
@@ -111,7 +111,7 @@ describe('queryOptions', () => {
111111
expectTypeOf(data).toEqualTypeOf<number | undefined>()
112112
})
113113

114-
test('Should return the proper type when passed to getQueryState', () => {
114+
test('should return the proper type when passed to getQueryState', () => {
115115
const key = queryKey()
116116
const { queryKey: tagged } = queryOptions({
117117
queryKey: key,
@@ -123,7 +123,7 @@ describe('queryOptions', () => {
123123
expectTypeOf(state?.data).toEqualTypeOf<number | undefined>()
124124
})
125125

126-
test('Should properly type updaterFn when passed to setQueryData', () => {
126+
test('should properly type updaterFn when passed to setQueryData', () => {
127127
const key = queryKey()
128128
const { queryKey: tagged } = queryOptions({
129129
queryKey: key,
@@ -138,7 +138,7 @@ describe('queryOptions', () => {
138138
expectTypeOf(data).toEqualTypeOf<number | undefined>()
139139
})
140140

141-
test('Should properly type value when passed to setQueryData', () => {
141+
test('should properly type value when passed to setQueryData', () => {
142142
const key = queryKey()
143143
const { queryKey: tagged } = queryOptions({
144144
queryKey: key,
@@ -156,7 +156,7 @@ describe('queryOptions', () => {
156156
expectTypeOf(data).toEqualTypeOf<number | undefined>()
157157
})
158158

159-
test('Should infer even if there is a conditional skipToken', () => {
159+
test('should infer even if there is a conditional skipToken', () => {
160160
const key = queryKey()
161161
const options = queryOptions({
162162
queryKey: key,
@@ -168,7 +168,7 @@ describe('queryOptions', () => {
168168
expectTypeOf(data).toEqualTypeOf<number | undefined>()
169169
})
170170

171-
test('Should infer to unknown if we disable a query with just a skipToken', () => {
171+
test('should infer to unknown if we disable a query with just a skipToken', () => {
172172
const key = queryKey()
173173
const options = queryOptions({
174174
queryKey: key,
@@ -180,7 +180,7 @@ describe('queryOptions', () => {
180180
expectTypeOf(data).toEqualTypeOf<unknown>()
181181
})
182182

183-
test('Should return the proper type when passed to QueriesObserver', () => {
183+
test('should return the proper type when passed to QueriesObserver', () => {
184184
const key = queryKey()
185185
const options = queryOptions({
186186
queryKey: key,
@@ -194,7 +194,7 @@ describe('queryOptions', () => {
194194
>()
195195
})
196196

197-
test('Should allow undefined response in initialData', () => {
197+
test('should allow undefined response in initialData', () => {
198198
const key = queryKey()
199199
const options = (id: string | null) =>
200200
queryOptions({

0 commit comments

Comments
 (0)