@tanstack/solid-query 5.0.0-alpha.84 → 5.0.0-alpha.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.86",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tanstack/query-core": "5.0.0-alpha.
|
|
39
|
+
"@tanstack/query-core": "5.0.0-alpha.86"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"vite-plugin-solid": "^2.5.0"
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '..'
|
|
16
16
|
import {
|
|
17
17
|
createQueryClient,
|
|
18
|
-
|
|
18
|
+
mockOnlineManagerIsOnline,
|
|
19
19
|
queryKey,
|
|
20
20
|
setActTimeout,
|
|
21
21
|
sleep,
|
|
@@ -495,7 +495,7 @@ describe('createMutation', () => {
|
|
|
495
495
|
})
|
|
496
496
|
|
|
497
497
|
it('should not retry mutations while offline', async () => {
|
|
498
|
-
const onlineMock =
|
|
498
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
499
499
|
|
|
500
500
|
let count = 0
|
|
501
501
|
|
|
@@ -535,6 +535,8 @@ describe('createMutation', () => {
|
|
|
535
535
|
).toBeInTheDocument()
|
|
536
536
|
})
|
|
537
537
|
|
|
538
|
+
window.dispatchEvent(new Event('offline'))
|
|
539
|
+
|
|
538
540
|
fireEvent.click(screen.getByRole('button', { name: /mutate/i }))
|
|
539
541
|
|
|
540
542
|
await waitFor(() => {
|
|
@@ -545,7 +547,7 @@ describe('createMutation', () => {
|
|
|
545
547
|
|
|
546
548
|
expect(count).toBe(0)
|
|
547
549
|
|
|
548
|
-
onlineMock.
|
|
550
|
+
onlineMock.mockRestore()
|
|
549
551
|
window.dispatchEvent(new Event('online'))
|
|
550
552
|
|
|
551
553
|
await sleep(100)
|
|
@@ -557,12 +559,10 @@ describe('createMutation', () => {
|
|
|
557
559
|
})
|
|
558
560
|
|
|
559
561
|
expect(count).toBe(2)
|
|
560
|
-
|
|
561
|
-
onlineMock.mockRestore()
|
|
562
562
|
})
|
|
563
563
|
|
|
564
564
|
it('should call onMutate even if paused', async () => {
|
|
565
|
-
const onlineMock =
|
|
565
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
566
566
|
const onMutate = vi.fn()
|
|
567
567
|
let count = 0
|
|
568
568
|
|
|
@@ -595,6 +595,8 @@ describe('createMutation', () => {
|
|
|
595
595
|
|
|
596
596
|
await screen.findByText('data: null, status: idle, isPaused: false')
|
|
597
597
|
|
|
598
|
+
window.dispatchEvent(new Event('offline'))
|
|
599
|
+
|
|
598
600
|
fireEvent.click(screen.getByRole('button', { name: /mutate/i }))
|
|
599
601
|
|
|
600
602
|
await screen.findByText('data: null, status: pending, isPaused: true')
|
|
@@ -602,19 +604,17 @@ describe('createMutation', () => {
|
|
|
602
604
|
expect(onMutate).toHaveBeenCalledTimes(1)
|
|
603
605
|
expect(onMutate).toHaveBeenCalledWith('todo')
|
|
604
606
|
|
|
605
|
-
onlineMock.
|
|
607
|
+
onlineMock.mockRestore()
|
|
606
608
|
window.dispatchEvent(new Event('online'))
|
|
607
609
|
|
|
608
610
|
await screen.findByText('data: 1, status: success, isPaused: false')
|
|
609
611
|
|
|
610
612
|
expect(onMutate).toHaveBeenCalledTimes(1)
|
|
611
613
|
expect(count).toBe(1)
|
|
612
|
-
|
|
613
|
-
onlineMock.mockRestore()
|
|
614
614
|
})
|
|
615
615
|
|
|
616
616
|
it('should optimistically go to paused state if offline', async () => {
|
|
617
|
-
const onlineMock =
|
|
617
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
618
618
|
let count = 0
|
|
619
619
|
const states: Array<string> = []
|
|
620
620
|
|
|
@@ -667,7 +667,7 @@ describe('createMutation', () => {
|
|
|
667
667
|
})
|
|
668
668
|
|
|
669
669
|
it('should be able to retry a mutation when online', async () => {
|
|
670
|
-
const onlineMock =
|
|
670
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
671
671
|
|
|
672
672
|
let count = 0
|
|
673
673
|
const states: CreateMutationResult<any, any, any, any>[] = []
|
|
@@ -693,6 +693,7 @@ describe('createMutation', () => {
|
|
|
693
693
|
createEffect(() => {
|
|
694
694
|
const { mutate } = mutation
|
|
695
695
|
setActTimeout(() => {
|
|
696
|
+
window.dispatchEvent(new Event('offline'))
|
|
696
697
|
mutate('todo')
|
|
697
698
|
}, 10)
|
|
698
699
|
})
|
|
@@ -734,7 +735,7 @@ describe('createMutation', () => {
|
|
|
734
735
|
failureReason: new Error('oops'),
|
|
735
736
|
})
|
|
736
737
|
|
|
737
|
-
onlineMock.
|
|
738
|
+
onlineMock.mockRestore()
|
|
738
739
|
window.dispatchEvent(new Event('online'))
|
|
739
740
|
|
|
740
741
|
await sleep(50)
|
|
@@ -753,8 +754,6 @@ describe('createMutation', () => {
|
|
|
753
754
|
failureReason: null,
|
|
754
755
|
data: 'data',
|
|
755
756
|
})
|
|
756
|
-
|
|
757
|
-
onlineMock.mockRestore()
|
|
758
757
|
})
|
|
759
758
|
|
|
760
759
|
it('should not change state if unmounted', async () => {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
Blink,
|
|
23
23
|
createQueryClient,
|
|
24
24
|
expectType,
|
|
25
|
-
|
|
25
|
+
mockOnlineManagerIsOnline,
|
|
26
26
|
mockVisibilityState,
|
|
27
27
|
queryKey,
|
|
28
28
|
setActTimeout,
|
|
@@ -2129,39 +2129,6 @@ describe('createQuery', () => {
|
|
|
2129
2129
|
screen.getByText('status: pending')
|
|
2130
2130
|
})
|
|
2131
2131
|
|
|
2132
|
-
// See https://github.com/tannerlinsley/react-query/issues/147
|
|
2133
|
-
it('should not pass stringified variables to query function', async () => {
|
|
2134
|
-
const key = queryKey()
|
|
2135
|
-
const variables = { number: 5, boolean: false, object: {}, array: [] }
|
|
2136
|
-
type CustomQueryKey = readonly [typeof key, typeof variables]
|
|
2137
|
-
const states: CreateQueryResult<CustomQueryKey, unknown>[] = []
|
|
2138
|
-
|
|
2139
|
-
function Page() {
|
|
2140
|
-
const state = createQuery(() => ({
|
|
2141
|
-
queryKey: [key, variables] as const,
|
|
2142
|
-
queryFn: async (ctx) => {
|
|
2143
|
-
await sleep(10)
|
|
2144
|
-
return ctx.queryKey
|
|
2145
|
-
},
|
|
2146
|
-
}))
|
|
2147
|
-
|
|
2148
|
-
createRenderEffect(() => {
|
|
2149
|
-
states.push({ ...state })
|
|
2150
|
-
})
|
|
2151
|
-
return null
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
render(() => (
|
|
2155
|
-
<QueryClientProvider client={queryClient}>
|
|
2156
|
-
<Page />
|
|
2157
|
-
</QueryClientProvider>
|
|
2158
|
-
))
|
|
2159
|
-
|
|
2160
|
-
await sleep(20)
|
|
2161
|
-
|
|
2162
|
-
expect(states[1]?.data).toEqual([key, variables])
|
|
2163
|
-
})
|
|
2164
|
-
|
|
2165
2132
|
it('should not refetch query on focus when `enabled` is set to `false`', async () => {
|
|
2166
2133
|
const key = queryKey()
|
|
2167
2134
|
const queryFn = vi.fn<unknown[], string>().mockReturnValue('data')
|
|
@@ -4999,7 +4966,7 @@ describe('createQuery', () => {
|
|
|
4999
4966
|
|
|
5000
4967
|
describe('networkMode online', () => {
|
|
5001
4968
|
it('online queries should not start fetching if you are offline', async () => {
|
|
5002
|
-
const onlineMock =
|
|
4969
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5003
4970
|
|
|
5004
4971
|
const key = queryKey()
|
|
5005
4972
|
const states: Array<any> = []
|
|
@@ -5033,9 +5000,11 @@ describe('createQuery', () => {
|
|
|
5033
5000
|
</QueryClientProvider>
|
|
5034
5001
|
))
|
|
5035
5002
|
|
|
5003
|
+
window.dispatchEvent(new Event('offline'))
|
|
5004
|
+
|
|
5036
5005
|
await waitFor(() => screen.getByText('status: pending, isPaused: true'))
|
|
5037
5006
|
|
|
5038
|
-
onlineMock.
|
|
5007
|
+
onlineMock.mockRestore()
|
|
5039
5008
|
window.dispatchEvent(new Event('online'))
|
|
5040
5009
|
|
|
5041
5010
|
await waitFor(() => screen.getByText('status: success, isPaused: false'))
|
|
@@ -5044,8 +5013,6 @@ describe('createQuery', () => {
|
|
|
5044
5013
|
})
|
|
5045
5014
|
|
|
5046
5015
|
expect(states).toEqual(['paused', 'fetching', 'idle'])
|
|
5047
|
-
|
|
5048
|
-
onlineMock.mockRestore()
|
|
5049
5016
|
})
|
|
5050
5017
|
|
|
5051
5018
|
it('online queries should not refetch if you are offline', async () => {
|
|
@@ -5087,7 +5054,8 @@ describe('createQuery', () => {
|
|
|
5087
5054
|
|
|
5088
5055
|
await waitFor(() => screen.getByText('data: data1'))
|
|
5089
5056
|
|
|
5090
|
-
const onlineMock =
|
|
5057
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5058
|
+
window.dispatchEvent(new Event('offline'))
|
|
5091
5059
|
fireEvent.click(screen.getByRole('button', { name: /invalidate/i }))
|
|
5092
5060
|
|
|
5093
5061
|
await waitFor(() =>
|
|
@@ -5097,7 +5065,7 @@ describe('createQuery', () => {
|
|
|
5097
5065
|
)
|
|
5098
5066
|
await waitFor(() => screen.getByText('failureReason: null'))
|
|
5099
5067
|
|
|
5100
|
-
onlineMock.
|
|
5068
|
+
onlineMock.mockRestore()
|
|
5101
5069
|
window.dispatchEvent(new Event('online'))
|
|
5102
5070
|
|
|
5103
5071
|
await waitFor(() =>
|
|
@@ -5114,8 +5082,6 @@ describe('createQuery', () => {
|
|
|
5114
5082
|
await waitFor(() => {
|
|
5115
5083
|
expect(screen.getByText('data: data2')).toBeInTheDocument()
|
|
5116
5084
|
})
|
|
5117
|
-
|
|
5118
|
-
onlineMock.mockRestore()
|
|
5119
5085
|
})
|
|
5120
5086
|
|
|
5121
5087
|
it('online queries should not refetch if you are offline and refocus', async () => {
|
|
@@ -5155,7 +5121,7 @@ describe('createQuery', () => {
|
|
|
5155
5121
|
|
|
5156
5122
|
await waitFor(() => screen.getByText('data: data1'))
|
|
5157
5123
|
|
|
5158
|
-
const onlineMock =
|
|
5124
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5159
5125
|
fireEvent.click(screen.getByRole('button', { name: /invalidate/i }))
|
|
5160
5126
|
|
|
5161
5127
|
await waitFor(() =>
|
|
@@ -5201,7 +5167,7 @@ describe('createQuery', () => {
|
|
|
5201
5167
|
)
|
|
5202
5168
|
}
|
|
5203
5169
|
|
|
5204
|
-
const onlineMock =
|
|
5170
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5205
5171
|
|
|
5206
5172
|
render(() => (
|
|
5207
5173
|
<QueryClientProvider client={queryClient}>
|
|
@@ -5256,7 +5222,7 @@ describe('createQuery', () => {
|
|
|
5256
5222
|
)
|
|
5257
5223
|
}
|
|
5258
5224
|
|
|
5259
|
-
const onlineMock =
|
|
5225
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5260
5226
|
|
|
5261
5227
|
render(() => (
|
|
5262
5228
|
<QueryClientProvider client={queryClient}>
|
|
@@ -5314,7 +5280,7 @@ describe('createQuery', () => {
|
|
|
5314
5280
|
)
|
|
5315
5281
|
}
|
|
5316
5282
|
|
|
5317
|
-
const onlineMock =
|
|
5283
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5318
5284
|
|
|
5319
5285
|
render(() => (
|
|
5320
5286
|
<QueryClientProvider client={queryClient}>
|
|
@@ -5322,6 +5288,8 @@ describe('createQuery', () => {
|
|
|
5322
5288
|
</QueryClientProvider>
|
|
5323
5289
|
))
|
|
5324
5290
|
|
|
5291
|
+
window.dispatchEvent(new Event('offline'))
|
|
5292
|
+
|
|
5325
5293
|
await waitFor(() =>
|
|
5326
5294
|
screen.getByText('status: success, fetchStatus: paused'),
|
|
5327
5295
|
)
|
|
@@ -5341,7 +5309,7 @@ describe('createQuery', () => {
|
|
|
5341
5309
|
// triggers a second pause
|
|
5342
5310
|
window.dispatchEvent(new Event('visibilitychange'))
|
|
5343
5311
|
|
|
5344
|
-
onlineMock.
|
|
5312
|
+
onlineMock.mockRestore()
|
|
5345
5313
|
window.dispatchEvent(new Event('online'))
|
|
5346
5314
|
|
|
5347
5315
|
await waitFor(() =>
|
|
@@ -5352,7 +5320,6 @@ describe('createQuery', () => {
|
|
|
5352
5320
|
})
|
|
5353
5321
|
|
|
5354
5322
|
expect(count).toBe(1)
|
|
5355
|
-
onlineMock.mockRestore()
|
|
5356
5323
|
})
|
|
5357
5324
|
|
|
5358
5325
|
it('online queries should pause retries if you are offline', async () => {
|
|
@@ -5395,7 +5362,8 @@ describe('createQuery', () => {
|
|
|
5395
5362
|
)
|
|
5396
5363
|
await waitFor(() => screen.getByText('failureReason: failed1'))
|
|
5397
5364
|
|
|
5398
|
-
|
|
5365
|
+
window.dispatchEvent(new Event('offline'))
|
|
5366
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5399
5367
|
|
|
5400
5368
|
await sleep(20)
|
|
5401
5369
|
|
|
@@ -5408,7 +5376,7 @@ describe('createQuery', () => {
|
|
|
5408
5376
|
|
|
5409
5377
|
expect(count).toBe(1)
|
|
5410
5378
|
|
|
5411
|
-
onlineMock.
|
|
5379
|
+
onlineMock.mockRestore()
|
|
5412
5380
|
window.dispatchEvent(new Event('online'))
|
|
5413
5381
|
|
|
5414
5382
|
await waitFor(() =>
|
|
@@ -5417,8 +5385,6 @@ describe('createQuery', () => {
|
|
|
5417
5385
|
await waitFor(() => screen.getByText('failureReason: failed3'))
|
|
5418
5386
|
|
|
5419
5387
|
expect(count).toBe(3)
|
|
5420
|
-
|
|
5421
|
-
onlineMock.mockRestore()
|
|
5422
5388
|
})
|
|
5423
5389
|
|
|
5424
5390
|
it('online queries should fetch if paused and we go online even if already unmounted (because not cancelled)', async () => {
|
|
@@ -5456,7 +5422,7 @@ describe('createQuery', () => {
|
|
|
5456
5422
|
)
|
|
5457
5423
|
}
|
|
5458
5424
|
|
|
5459
|
-
const onlineMock =
|
|
5425
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5460
5426
|
|
|
5461
5427
|
render(() => (
|
|
5462
5428
|
<QueryClientProvider client={queryClient}>
|
|
@@ -5464,13 +5430,15 @@ describe('createQuery', () => {
|
|
|
5464
5430
|
</QueryClientProvider>
|
|
5465
5431
|
))
|
|
5466
5432
|
|
|
5433
|
+
window.dispatchEvent(new Event('offline'))
|
|
5434
|
+
|
|
5467
5435
|
await waitFor(() =>
|
|
5468
5436
|
screen.getByText('status: pending, fetchStatus: paused'),
|
|
5469
5437
|
)
|
|
5470
5438
|
|
|
5471
5439
|
fireEvent.click(screen.getByRole('button', { name: /hide/i }))
|
|
5472
5440
|
|
|
5473
|
-
onlineMock.
|
|
5441
|
+
onlineMock.mockRestore()
|
|
5474
5442
|
window.dispatchEvent(new Event('online'))
|
|
5475
5443
|
|
|
5476
5444
|
await sleep(15)
|
|
@@ -5481,8 +5449,6 @@ describe('createQuery', () => {
|
|
|
5481
5449
|
})
|
|
5482
5450
|
|
|
5483
5451
|
expect(count).toBe(1)
|
|
5484
|
-
|
|
5485
|
-
onlineMock.mockRestore()
|
|
5486
5452
|
})
|
|
5487
5453
|
|
|
5488
5454
|
it('online queries should not fetch if paused and we go online when cancelled and no refetchOnReconnect', async () => {
|
|
@@ -5515,7 +5481,7 @@ describe('createQuery', () => {
|
|
|
5515
5481
|
)
|
|
5516
5482
|
}
|
|
5517
5483
|
|
|
5518
|
-
const onlineMock =
|
|
5484
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5519
5485
|
|
|
5520
5486
|
render(() => (
|
|
5521
5487
|
<QueryClientProvider client={queryClient}>
|
|
@@ -5599,7 +5565,7 @@ describe('createQuery', () => {
|
|
|
5599
5565
|
screen.getByText('status: success, fetchStatus: idle'),
|
|
5600
5566
|
)
|
|
5601
5567
|
|
|
5602
|
-
const onlineMock =
|
|
5568
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5603
5569
|
|
|
5604
5570
|
fireEvent.click(screen.getByRole('button', { name: /invalidate/i }))
|
|
5605
5571
|
|
|
@@ -5629,7 +5595,7 @@ describe('createQuery', () => {
|
|
|
5629
5595
|
|
|
5630
5596
|
describe('networkMode always', () => {
|
|
5631
5597
|
it('always queries should start fetching even if you are offline', async () => {
|
|
5632
|
-
const onlineMock =
|
|
5598
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5633
5599
|
|
|
5634
5600
|
const key = queryKey()
|
|
5635
5601
|
let count = 0
|
|
@@ -5671,7 +5637,7 @@ describe('createQuery', () => {
|
|
|
5671
5637
|
})
|
|
5672
5638
|
|
|
5673
5639
|
it('always queries should not pause retries', async () => {
|
|
5674
|
-
const onlineMock =
|
|
5640
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5675
5641
|
|
|
5676
5642
|
const key = queryKey()
|
|
5677
5643
|
let count = 0
|
|
@@ -5721,7 +5687,7 @@ describe('createQuery', () => {
|
|
|
5721
5687
|
|
|
5722
5688
|
describe('networkMode offlineFirst', () => {
|
|
5723
5689
|
it('offlineFirst queries should start fetching if you are offline, but pause retries', async () => {
|
|
5724
|
-
const onlineMock =
|
|
5690
|
+
const onlineMock = mockOnlineManagerIsOnline(false)
|
|
5725
5691
|
|
|
5726
5692
|
const key = queryKey()
|
|
5727
5693
|
let count = 0
|
|
@@ -5756,6 +5722,8 @@ describe('createQuery', () => {
|
|
|
5756
5722
|
</QueryClientProvider>
|
|
5757
5723
|
))
|
|
5758
5724
|
|
|
5725
|
+
window.dispatchEvent(new Event('offline'))
|
|
5726
|
+
|
|
5759
5727
|
await waitFor(() =>
|
|
5760
5728
|
screen.getByText(
|
|
5761
5729
|
'status: pending, fetchStatus: paused, failureCount: 1',
|
|
@@ -5765,7 +5733,7 @@ describe('createQuery', () => {
|
|
|
5765
5733
|
|
|
5766
5734
|
expect(count).toBe(1)
|
|
5767
5735
|
|
|
5768
|
-
onlineMock.
|
|
5736
|
+
onlineMock.mockRestore()
|
|
5769
5737
|
window.dispatchEvent(new Event('online'))
|
|
5770
5738
|
|
|
5771
5739
|
await waitFor(() =>
|
|
@@ -5774,8 +5742,6 @@ describe('createQuery', () => {
|
|
|
5774
5742
|
await waitFor(() => screen.getByText('failureReason: failed3'))
|
|
5775
5743
|
|
|
5776
5744
|
expect(count).toBe(3)
|
|
5777
|
-
|
|
5778
|
-
onlineMock.mockRestore()
|
|
5779
5745
|
})
|
|
5780
5746
|
})
|
|
5781
5747
|
|
package/src/__tests__/utils.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Show, createEffect, createSignal, onCleanup } from 'solid-js'
|
|
2
2
|
import { vi } from 'vitest'
|
|
3
|
+
import { onlineManager } from '@tanstack/query-core'
|
|
3
4
|
import { QueryClient } from '../QueryClient'
|
|
4
5
|
import type { QueryClientConfig } from '@tanstack/query-core'
|
|
5
6
|
import type { ParentProps } from 'solid-js'
|
|
7
|
+
import type { SpyInstance } from 'vitest'
|
|
6
8
|
|
|
7
9
|
let queryKeyCount = 0
|
|
8
10
|
export function queryKey(): Array<string> {
|
|
@@ -34,12 +36,16 @@ export function createQueryClient(config?: QueryClientConfig): QueryClient {
|
|
|
34
36
|
return new QueryClient(config)
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
export function mockVisibilityState(
|
|
39
|
+
export function mockVisibilityState(
|
|
40
|
+
value: DocumentVisibilityState,
|
|
41
|
+
): SpyInstance<[], DocumentVisibilityState> {
|
|
38
42
|
return vi.spyOn(document, 'visibilityState', 'get').mockReturnValue(value)
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
export function
|
|
42
|
-
|
|
45
|
+
export function mockOnlineManagerIsOnline(
|
|
46
|
+
value: boolean,
|
|
47
|
+
): SpyInstance<[], boolean> {
|
|
48
|
+
return vi.spyOn(onlineManager, 'isOnline').mockReturnValue(value)
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
export function sleep(timeout: number): Promise<void> {
|