@data-client/vue 0.2.0 → 0.3.1
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/README.md +2 -25
- package/dist/index.js +200 -42
- package/dist/index.umd.min.js +1 -1
- package/lib/consumers/index.d.ts +2 -0
- package/lib/consumers/index.d.ts.map +1 -1
- package/lib/consumers/index.js +3 -1
- package/lib/consumers/useCache.d.ts +12 -0
- package/lib/consumers/useCache.d.ts.map +1 -0
- package/lib/consumers/useCache.js +63 -0
- package/lib/consumers/useDLE.d.ts +18 -0
- package/lib/consumers/useDLE.d.ts.map +1 -0
- package/lib/consumers/useDLE.js +88 -0
- package/lib/consumers/useFetch.d.ts +3 -4
- package/lib/consumers/useFetch.d.ts.map +1 -1
- package/lib/consumers/useFetch.js +10 -10
- package/lib/consumers/useLive.d.ts +3 -2
- package/lib/consumers/useLive.d.ts.map +1 -1
- package/lib/consumers/useLive.js +1 -1
- package/lib/consumers/useQuery.d.ts +5 -6
- package/lib/consumers/useQuery.d.ts.map +1 -1
- package/lib/consumers/useQuery.js +9 -7
- package/lib/consumers/useSubscription.d.ts +2 -1
- package/lib/consumers/useSubscription.d.ts.map +1 -1
- package/lib/consumers/useSubscription.js +1 -2
- package/lib/consumers/useSuspense.d.ts +11 -2
- package/lib/consumers/useSuspense.d.ts.map +1 -1
- package/lib/consumers/useSuspense.js +25 -20
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/providers/DataClientPlugin.d.ts +6 -0
- package/lib/providers/DataClientPlugin.d.ts.map +1 -1
- package/lib/providers/DataClientPlugin.js +15 -11
- package/lib/providers/getDefaultManagers.d.ts +4 -1
- package/lib/providers/getDefaultManagers.d.ts.map +1 -1
- package/lib/providers/getDefaultManagers.js +5 -2
- package/lib/providers/index.d.ts +1 -1
- package/lib/providers/index.d.ts.map +1 -1
- package/lib/providers/index.js +1 -1
- package/lib/test/index.d.ts +3 -4
- package/lib/test/index.d.ts.map +1 -1
- package/lib/test/index.js +3 -5
- package/lib/test/mountDataClient.d.ts +29 -0
- package/lib/test/mountDataClient.d.ts.map +1 -0
- package/lib/test/mountDataClient.js +114 -0
- package/lib/test/renderDataCompose.d.ts +19 -0
- package/lib/test/renderDataCompose.d.ts.map +1 -0
- package/lib/test/renderDataCompose.js +135 -0
- package/lib/types.d.ts +10 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/package.json +11 -9
- package/src/__tests__/context.test.ts +195 -0
- package/src/__tests__/integration-garbage-collection.web.ts +12 -15
- package/src/__tests__/useCache.web.ts +391 -0
- package/src/__tests__/useDLE.web.ts +660 -0
- package/src/__tests__/useQuery.web.ts +332 -50
- package/src/__tests__/useSubscription.web.ts +233 -119
- package/src/__tests__/useSuspense.web.ts +176 -50
- package/src/consumers/index.ts +2 -0
- package/src/consumers/useCache.ts +122 -0
- package/src/consumers/useDLE.ts +160 -0
- package/src/consumers/useFetch.ts +24 -15
- package/src/consumers/useLive.ts +6 -2
- package/src/consumers/useQuery.ts +16 -9
- package/src/consumers/useSubscription.ts +5 -1
- package/src/consumers/useSuspense.ts +37 -17
- package/src/index.ts +4 -0
- package/src/providers/DataClientPlugin.ts +25 -10
- package/src/providers/__tests__/DataClientPlugin.test.ts +204 -4
- package/src/providers/__tests__/createDataClient.test.ts +234 -0
- package/src/providers/__tests__/getDefaultManagers.test.ts +180 -0
- package/src/providers/getDefaultManagers.ts +4 -1
- package/src/providers/index.ts +5 -1
- package/src/test/README.md +77 -16
- package/src/test/__tests__/mountDataClient.test.ts +426 -0
- package/src/test/__tests__/renderDataCompose.test.ts +586 -0
- package/src/test/index.ts +3 -9
- package/src/test/mountDataClient.ts +169 -0
- package/src/test/renderDataCompose.ts +150 -0
- package/src/types.ts +11 -0
- package/lib/test/renderDataClient.d.ts +0 -40
- package/lib/test/renderDataClient.d.ts.map +0 -1
- package/lib/test/renderDataClient.js +0 -264
- package/src/__tests__/__snapshots__/useSubscription.web.ts.snap +0 -7
- package/src/test/renderDataClient.ts +0 -316
- package/ts3.4/consumers/index.d.ts +0 -9
- package/ts3.4/consumers/useDebounce.d.ts +0 -19
- package/ts3.4/consumers/useFetch.d.ts +0 -16
- package/ts3.4/consumers/useLive.d.ts +0 -19
- package/ts3.4/consumers/useLoading.d.ts +0 -22
- package/ts3.4/consumers/useQuery.d.ts +0 -12
- package/ts3.4/consumers/useSubscription.d.ts +0 -12
- package/ts3.4/consumers/useSuspense.d.ts +0 -11
- package/ts3.4/context.d.ts +0 -10
- package/ts3.4/index.d.ts +0 -6
- package/ts3.4/managers/index.d.ts +0 -2
- package/ts3.4/providers/DataClientPlugin.d.ts +0 -22
- package/ts3.4/providers/createDataClient.d.ts +0 -25
- package/ts3.4/providers/getDefaultManagers.d.ts +0 -14
- package/ts3.4/providers/index.d.ts +0 -4
- package/ts3.4/test/MockController.d.ts +0 -8
- package/ts3.4/test/collapseFixture.d.ts +0 -6
- package/ts3.4/test/createFixtureMap.d.ts +0 -6
- package/ts3.4/test/fixtureTypes.d.ts +0 -99
- package/ts3.4/test/index.d.ts +0 -8
- package/ts3.4/test/mockState.d.ts +0 -4
- package/ts3.4/test/renderDataClient.d.ts +0 -40
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import nock from 'nock';
|
|
2
|
+
import { computed, defineComponent, h, nextTick, reactive } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { CoolerArticleResource } from '../../../../__tests__/new';
|
|
5
|
+
import useCache from '../consumers/useCache';
|
|
6
|
+
import { renderDataCompose, mountDataClient } from '../test';
|
|
7
|
+
|
|
8
|
+
// Minimal shared fixture (copied from React test fixtures)
|
|
9
|
+
const payload = {
|
|
10
|
+
id: 5,
|
|
11
|
+
title: 'hi ho',
|
|
12
|
+
content: 'whatever',
|
|
13
|
+
tags: ['a', 'best', 'react'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const payload2 = {
|
|
17
|
+
id: 6,
|
|
18
|
+
title: 'next',
|
|
19
|
+
content: 'my best content yet',
|
|
20
|
+
tags: ['b'],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('vue useCache()', () => {
|
|
24
|
+
async function flushUntil(
|
|
25
|
+
wrapper: any,
|
|
26
|
+
predicate: () => boolean,
|
|
27
|
+
tries = 100,
|
|
28
|
+
) {
|
|
29
|
+
for (let i = 0; i < tries; i++) {
|
|
30
|
+
if (predicate()) return;
|
|
31
|
+
await Promise.resolve();
|
|
32
|
+
await nextTick();
|
|
33
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
beforeAll(() => {
|
|
38
|
+
nock(/.*/)
|
|
39
|
+
.persist()
|
|
40
|
+
.defaultReplyHeaders({
|
|
41
|
+
'Access-Control-Allow-Origin': '*',
|
|
42
|
+
'Access-Control-Allow-Headers': 'Access-Token',
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
})
|
|
45
|
+
.options(/.*/)
|
|
46
|
+
.reply(200)
|
|
47
|
+
.get(`/article-cooler/${payload.id}`)
|
|
48
|
+
.reply(200, payload)
|
|
49
|
+
.get(`/article-cooler/${payload2.id}`)
|
|
50
|
+
.reply(200, payload2)
|
|
51
|
+
.put(`/article-cooler/${payload.id}`)
|
|
52
|
+
.reply(200, (uri, requestBody: any) => ({
|
|
53
|
+
...payload,
|
|
54
|
+
...requestBody,
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
afterAll(() => {
|
|
59
|
+
nock.cleanAll();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('returns undefined on empty store (no fetch)', async () => {
|
|
63
|
+
const { result, cleanup } = await renderDataCompose(() =>
|
|
64
|
+
useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// The value should be undefined since we haven't fetched yet
|
|
68
|
+
expect(result.value).toBeUndefined();
|
|
69
|
+
|
|
70
|
+
cleanup();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('returns data when already in cache', async () => {
|
|
74
|
+
const { result, waitForNextUpdate, cleanup } = await renderDataCompose(
|
|
75
|
+
() => useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
76
|
+
{
|
|
77
|
+
initialFixtures: [
|
|
78
|
+
{
|
|
79
|
+
endpoint: CoolerArticleResource.get,
|
|
80
|
+
args: [{ id: payload.id }],
|
|
81
|
+
response: payload,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// Wait for initial render
|
|
88
|
+
await waitForNextUpdate();
|
|
89
|
+
|
|
90
|
+
// The value should be the cached data
|
|
91
|
+
expect(result.value).toBeDefined();
|
|
92
|
+
expect(result.value?.title).toBe(payload.title);
|
|
93
|
+
expect(result.value?.content).toBe(payload.content);
|
|
94
|
+
|
|
95
|
+
cleanup();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('re-renders when controller.setResponse() updates data', async () => {
|
|
99
|
+
const { result, controller, waitForNextUpdate, cleanup } =
|
|
100
|
+
await renderDataCompose(
|
|
101
|
+
() => useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
102
|
+
{
|
|
103
|
+
initialFixtures: [
|
|
104
|
+
{
|
|
105
|
+
endpoint: CoolerArticleResource.get,
|
|
106
|
+
args: [{ id: payload.id }],
|
|
107
|
+
response: payload,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// Wait for initial render
|
|
114
|
+
await waitForNextUpdate();
|
|
115
|
+
|
|
116
|
+
// Verify initial values
|
|
117
|
+
expect(result.value?.title).toBe(payload.title);
|
|
118
|
+
expect(result.value?.content).toBe(payload.content);
|
|
119
|
+
|
|
120
|
+
// Update the store using controller.setResponse
|
|
121
|
+
const newTitle = payload.title + ' updated';
|
|
122
|
+
const newContent = payload.content + ' v2';
|
|
123
|
+
controller.setResponse(
|
|
124
|
+
CoolerArticleResource.get,
|
|
125
|
+
{ id: payload.id },
|
|
126
|
+
{ ...payload, title: newTitle, content: newContent },
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Wait a tick for Vue reactivity to propagate
|
|
130
|
+
await nextTick();
|
|
131
|
+
|
|
132
|
+
// The ComputedRef should now have updated values (it's reactive!)
|
|
133
|
+
expect(result.value?.title).toBe(newTitle);
|
|
134
|
+
expect(result.value?.content).toBe(newContent);
|
|
135
|
+
|
|
136
|
+
cleanup();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('re-renders when controller.fetch() mutates data', async () => {
|
|
140
|
+
const { result, controller, waitForNextUpdate, cleanup } =
|
|
141
|
+
await renderDataCompose(
|
|
142
|
+
() => useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
143
|
+
{
|
|
144
|
+
initialFixtures: [
|
|
145
|
+
{
|
|
146
|
+
endpoint: CoolerArticleResource.get,
|
|
147
|
+
args: [{ id: payload.id }],
|
|
148
|
+
response: payload,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// Wait for initial render
|
|
155
|
+
await waitForNextUpdate();
|
|
156
|
+
|
|
157
|
+
// Verify initial values
|
|
158
|
+
expect(result.value?.title).toBe(payload.title);
|
|
159
|
+
expect(result.value?.content).toBe(payload.content);
|
|
160
|
+
|
|
161
|
+
// Mutate the data using controller.fetch with update endpoint
|
|
162
|
+
const updatedTitle = payload.title + ' mutated';
|
|
163
|
+
const updatedContent = payload.content + ' mutated';
|
|
164
|
+
|
|
165
|
+
await controller.fetch(
|
|
166
|
+
CoolerArticleResource.update,
|
|
167
|
+
{ id: payload.id },
|
|
168
|
+
{ title: updatedTitle, content: updatedContent },
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
// Wait a tick for Vue reactivity to propagate
|
|
172
|
+
await nextTick();
|
|
173
|
+
|
|
174
|
+
// The ComputedRef should now have updated values (it's reactive!)
|
|
175
|
+
expect(result.value?.title).toBe(updatedTitle);
|
|
176
|
+
expect(result.value?.content).toBe(updatedContent);
|
|
177
|
+
|
|
178
|
+
cleanup();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should update when props change', async () => {
|
|
182
|
+
nock.cleanAll();
|
|
183
|
+
|
|
184
|
+
const fetchMock1 = jest.fn(() => payload);
|
|
185
|
+
const fetchMock2 = jest.fn(() => payload2);
|
|
186
|
+
|
|
187
|
+
nock(/.*/)
|
|
188
|
+
.persist()
|
|
189
|
+
.defaultReplyHeaders({
|
|
190
|
+
'Access-Control-Allow-Origin': '*',
|
|
191
|
+
'Access-Control-Allow-Headers': 'Access-Token',
|
|
192
|
+
'Content-Type': 'application/json',
|
|
193
|
+
})
|
|
194
|
+
.options(/.*/)
|
|
195
|
+
.reply(200)
|
|
196
|
+
.get(`/article-cooler/${payload.id}`)
|
|
197
|
+
.reply(200, fetchMock1)
|
|
198
|
+
.get(`/article-cooler/${payload2.id}`)
|
|
199
|
+
.reply(200, fetchMock2);
|
|
200
|
+
|
|
201
|
+
const ArticleWithProps = defineComponent({
|
|
202
|
+
name: 'ArticleWithProps',
|
|
203
|
+
props: {
|
|
204
|
+
id: {
|
|
205
|
+
type: Number,
|
|
206
|
+
required: true,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
setup(props: { id: number }) {
|
|
210
|
+
// Pass the reactive value - useCache will track changes via its internal computed
|
|
211
|
+
const article = useCache(CoolerArticleResource.get, props);
|
|
212
|
+
|
|
213
|
+
return () =>
|
|
214
|
+
h('div', [
|
|
215
|
+
h('h3', (article as any).value?.title || 'Loading...'),
|
|
216
|
+
h('p', (article as any).value?.content || ''),
|
|
217
|
+
]);
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// Use mountDataClient to properly set up the test environment
|
|
222
|
+
const props = reactive({ id: payload.id });
|
|
223
|
+
const { wrapper, cleanup } = mountDataClient(ArticleWithProps, {
|
|
224
|
+
props,
|
|
225
|
+
initialFixtures: [
|
|
226
|
+
{
|
|
227
|
+
endpoint: CoolerArticleResource.get,
|
|
228
|
+
args: [{ id: payload.id }],
|
|
229
|
+
response: payload,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
endpoint: CoolerArticleResource.get,
|
|
233
|
+
args: [{ id: payload2.id }],
|
|
234
|
+
response: payload2,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Wait for data to render
|
|
240
|
+
await flushUntil(
|
|
241
|
+
wrapper,
|
|
242
|
+
() => wrapper.find('h3').text() === payload.title,
|
|
243
|
+
);
|
|
244
|
+
expect(wrapper.find('h3').text()).toBe(payload.title);
|
|
245
|
+
expect(wrapper.find('p').text()).toBe(payload.content);
|
|
246
|
+
|
|
247
|
+
// Change the id prop
|
|
248
|
+
props.id = payload2.id;
|
|
249
|
+
await nextTick();
|
|
250
|
+
|
|
251
|
+
// Wait for the new data to render
|
|
252
|
+
await flushUntil(
|
|
253
|
+
wrapper,
|
|
254
|
+
() =>
|
|
255
|
+
wrapper.find('h3').exists() &&
|
|
256
|
+
wrapper.find('h3').text() === payload2.title,
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
expect(wrapper.find('h3').text()).toBe(payload2.title);
|
|
260
|
+
expect(wrapper.find('p').text()).toBe(payload2.content);
|
|
261
|
+
|
|
262
|
+
cleanup();
|
|
263
|
+
|
|
264
|
+
// Restore the original nock interceptors from beforeAll
|
|
265
|
+
nock.cleanAll();
|
|
266
|
+
nock(/.*/)
|
|
267
|
+
.persist()
|
|
268
|
+
.defaultReplyHeaders({
|
|
269
|
+
'Access-Control-Allow-Origin': '*',
|
|
270
|
+
'Access-Control-Allow-Headers': 'Access-Token',
|
|
271
|
+
'Content-Type': 'application/json',
|
|
272
|
+
})
|
|
273
|
+
.options(/.*/)
|
|
274
|
+
.reply(200)
|
|
275
|
+
.get(`/article-cooler/${payload.id}`)
|
|
276
|
+
.reply(200, payload)
|
|
277
|
+
.get(`/article-cooler/${payload2.id}`)
|
|
278
|
+
.reply(200, payload2)
|
|
279
|
+
.put(`/article-cooler/${payload.id}`)
|
|
280
|
+
.reply(200, (uri, requestBody: any) => ({
|
|
281
|
+
...payload,
|
|
282
|
+
...requestBody,
|
|
283
|
+
}));
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('should handle null args by returning undefined', async () => {
|
|
287
|
+
const props = reactive({ id: payload.id as number | null });
|
|
288
|
+
const { result, waitForNextUpdate, cleanup } = await renderDataCompose(
|
|
289
|
+
(props: { id: number | null }) =>
|
|
290
|
+
useCache(
|
|
291
|
+
CoolerArticleResource.get,
|
|
292
|
+
computed(() => (props.id !== null ? { id: props.id } : null)),
|
|
293
|
+
),
|
|
294
|
+
{
|
|
295
|
+
props,
|
|
296
|
+
initialFixtures: [
|
|
297
|
+
{
|
|
298
|
+
endpoint: CoolerArticleResource.get,
|
|
299
|
+
args: [{ id: payload.id }],
|
|
300
|
+
response: payload,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
endpoint: CoolerArticleResource.get,
|
|
304
|
+
args: [{ id: payload2.id }],
|
|
305
|
+
response: payload2,
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// Wait for initial render
|
|
312
|
+
await waitForNextUpdate();
|
|
313
|
+
|
|
314
|
+
expect(result.value).toBeDefined();
|
|
315
|
+
|
|
316
|
+
// Verify initial values
|
|
317
|
+
expect(result.value?.title).toBe(payload.title);
|
|
318
|
+
expect(result.value?.content).toBe(payload.content);
|
|
319
|
+
|
|
320
|
+
// Change to null - the ComputedRef should reactively become undefined
|
|
321
|
+
props.id = null;
|
|
322
|
+
await nextTick();
|
|
323
|
+
|
|
324
|
+
// The same ComputedRef should now have undefined value
|
|
325
|
+
expect(result.value).toBeUndefined();
|
|
326
|
+
|
|
327
|
+
// Change back to valid id - should get cached data
|
|
328
|
+
props.id = payload2.id;
|
|
329
|
+
await nextTick();
|
|
330
|
+
|
|
331
|
+
// The ComputedRef should now have the new article data
|
|
332
|
+
expect(result.value).toBeDefined();
|
|
333
|
+
expect(result.value?.title).toBe(payload2.title);
|
|
334
|
+
expect(result.value?.content).toBe(payload2.content);
|
|
335
|
+
|
|
336
|
+
cleanup();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it('returns undefined for stale data when invalidIfStale is true', async () => {
|
|
340
|
+
const { result, controller, waitForNextUpdate, cleanup } =
|
|
341
|
+
await renderDataCompose(
|
|
342
|
+
() => useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
343
|
+
{
|
|
344
|
+
initialFixtures: [
|
|
345
|
+
{
|
|
346
|
+
endpoint: CoolerArticleResource.get,
|
|
347
|
+
args: [{ id: payload.id }],
|
|
348
|
+
response: payload,
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
},
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
// Wait for initial render
|
|
355
|
+
await waitForNextUpdate();
|
|
356
|
+
|
|
357
|
+
// Invalidate the data
|
|
358
|
+
controller.invalidate(CoolerArticleResource.get, { id: payload.id });
|
|
359
|
+
|
|
360
|
+
await nextTick();
|
|
361
|
+
|
|
362
|
+
// The value should be undefined since the data is invalid
|
|
363
|
+
expect(result.value).toBeUndefined();
|
|
364
|
+
|
|
365
|
+
cleanup();
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it('returns cached data even if expired when expiryStatus is Valid', async () => {
|
|
369
|
+
const { result, waitForNextUpdate, cleanup } = await renderDataCompose(
|
|
370
|
+
() => useCache(CoolerArticleResource.get, { id: payload.id }),
|
|
371
|
+
{
|
|
372
|
+
initialFixtures: [
|
|
373
|
+
{
|
|
374
|
+
endpoint: CoolerArticleResource.get,
|
|
375
|
+
args: [{ id: payload.id }],
|
|
376
|
+
response: payload,
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
},
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
// Wait for initial render
|
|
383
|
+
await waitForNextUpdate();
|
|
384
|
+
|
|
385
|
+
// Even though data might be expired, if it's Valid it should be returned
|
|
386
|
+
expect(result.value).toBeDefined();
|
|
387
|
+
expect(result.value?.title).toBe(payload.title);
|
|
388
|
+
|
|
389
|
+
cleanup();
|
|
390
|
+
});
|
|
391
|
+
});
|