@data-client/vue 0.3.2 → 0.15.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +151 -3
  2. package/README.md +39 -35
  3. package/dist/index.js +2 -2
  4. package/dist/index.umd.min.js +1 -1
  5. package/lib/context.d.ts.map +1 -1
  6. package/lib/context.js +3 -3
  7. package/lib/test/MockPlugin.d.ts +34 -0
  8. package/lib/test/MockPlugin.d.ts.map +1 -0
  9. package/lib/test/MockPlugin.js +71 -0
  10. package/lib/test/index.d.ts +3 -2
  11. package/lib/test/index.d.ts.map +1 -1
  12. package/lib/test/index.js +3 -2
  13. package/lib/test/mockState.d.ts +1 -3
  14. package/lib/test/mockState.d.ts.map +1 -1
  15. package/lib/test/mockState.js +2 -44
  16. package/lib/test/mountDataClient.d.ts +1 -1
  17. package/lib/test/mountDataClient.d.ts.map +1 -1
  18. package/lib/test/mountDataClient.js +2 -2
  19. package/package.json +4 -5
  20. package/src/__tests__/__snapshots__/context.test.ts.snap +13 -0
  21. package/src/__tests__/context.test.ts +2 -15
  22. package/src/context.ts +6 -4
  23. package/src/providers/__tests__/MockPlugin.test.ts +726 -0
  24. package/src/test/MockPlugin.ts +89 -0
  25. package/src/test/index.ts +3 -2
  26. package/src/test/mockState.ts +1 -57
  27. package/src/test/mountDataClient.ts +2 -2
  28. package/lib/test/MockController.d.ts +0 -8
  29. package/lib/test/MockController.d.ts.map +0 -1
  30. package/lib/test/MockController.js +0 -125
  31. package/lib/test/collapseFixture.d.ts +0 -6
  32. package/lib/test/collapseFixture.d.ts.map +0 -1
  33. package/lib/test/collapseFixture.js +0 -19
  34. package/lib/test/createFixtureMap.d.ts +0 -3
  35. package/lib/test/createFixtureMap.d.ts.map +0 -1
  36. package/lib/test/createFixtureMap.js +0 -23
  37. package/lib/test/fixtureTypes.d.ts +0 -99
  38. package/lib/test/fixtureTypes.d.ts.map +0 -1
  39. package/lib/test/fixtureTypes.js +0 -2
  40. package/src/test/MockController.ts +0 -151
  41. package/src/test/collapseFixture.ts +0 -21
  42. package/src/test/createFixtureMap.ts +0 -26
  43. package/src/test/fixtureTypes.ts +0 -121
@@ -0,0 +1,726 @@
1
+ import {
2
+ Controller,
3
+ NetworkManager,
4
+ PollingSubscription,
5
+ SubscriptionManager,
6
+ } from '@data-client/core';
7
+ import type { State } from '@data-client/core';
8
+ import {
9
+ describe,
10
+ it,
11
+ expect,
12
+ jest,
13
+ beforeEach,
14
+ afterEach,
15
+ } from '@jest/globals';
16
+ import { mount } from '@vue/test-utils';
17
+ import { defineComponent, h, inject, shallowRef } from 'vue';
18
+
19
+ import { CoolerArticleResource } from '../../../../../__tests__/new';
20
+ import useQuery from '../../consumers/useQuery';
21
+ import useSuspense from '../../consumers/useSuspense';
22
+ import { ControllerKey, StateKey } from '../../context';
23
+ import { MockPlugin } from '../../test/MockPlugin';
24
+ import { DataClientPlugin } from '../DataClientPlugin';
25
+
26
+ describe('MockPlugin', () => {
27
+ beforeEach(() => {
28
+ jest.clearAllMocks();
29
+ });
30
+
31
+ afterEach(() => {
32
+ jest.restoreAllMocks();
33
+ });
34
+
35
+ it('should install plugin with fixtures', () => {
36
+ const payload = {
37
+ id: 5,
38
+ title: 'hi ho',
39
+ content: 'whatever',
40
+ tags: ['a', 'best', 'react'],
41
+ };
42
+
43
+ const TestComponent = defineComponent({
44
+ name: 'TestComponent',
45
+ setup() {
46
+ const controller = inject(ControllerKey);
47
+ return () =>
48
+ h('div', [
49
+ h('div', { id: 'has-controller' }, controller ? 'yes' : 'no'),
50
+ h(
51
+ 'div',
52
+ { id: 'controller-type' },
53
+ controller instanceof Controller ? 'Controller' : 'unknown',
54
+ ),
55
+ ]);
56
+ },
57
+ });
58
+
59
+ const wrapper = mount(TestComponent, {
60
+ global: {
61
+ plugins: [
62
+ [DataClientPlugin],
63
+ [
64
+ MockPlugin,
65
+ {
66
+ fixtures: [
67
+ {
68
+ endpoint: CoolerArticleResource.get,
69
+ args: [{ id: payload.id }],
70
+ response: payload,
71
+ },
72
+ ],
73
+ },
74
+ ],
75
+ ],
76
+ },
77
+ });
78
+
79
+ expect(wrapper.find('#has-controller').text()).toBe('yes');
80
+ expect(wrapper.find('#controller-type').text()).toBe('Controller');
81
+
82
+ wrapper.unmount();
83
+ });
84
+
85
+ it('should provide mocked controller that intercepts fetch requests', async () => {
86
+ const payload = {
87
+ id: 5,
88
+ title: 'hi ho',
89
+ content: 'whatever',
90
+ tags: ['a', 'best', 'react'],
91
+ };
92
+
93
+ const TestComponent = defineComponent({
94
+ name: 'TestComponent',
95
+ setup() {
96
+ // Verify controller is available (injected by MockPlugin)
97
+ inject(ControllerKey);
98
+ return () => h('div', { id: 'test' }, 'test');
99
+ },
100
+ });
101
+
102
+ const wrapper = mount(TestComponent, {
103
+ global: {
104
+ plugins: [
105
+ [DataClientPlugin],
106
+ [
107
+ MockPlugin,
108
+ {
109
+ fixtures: [
110
+ {
111
+ endpoint: CoolerArticleResource.get,
112
+ args: [{ id: payload.id }],
113
+ response: payload,
114
+ },
115
+ ],
116
+ },
117
+ ],
118
+ ],
119
+ },
120
+ });
121
+
122
+ const controller = wrapper.vm.$dataClient as Controller;
123
+
124
+ // Fetch should use the fixture
125
+ const result = await controller.fetch(CoolerArticleResource.get, {
126
+ id: payload.id,
127
+ });
128
+
129
+ expect(result.id).toBe(payload.id);
130
+ expect(result.title).toBe(payload.title);
131
+ expect(result.content).toBe(payload.content);
132
+ expect(result.tags).toEqual(payload.tags);
133
+
134
+ wrapper.unmount();
135
+ });
136
+
137
+ it('should work with multiple fixtures', async () => {
138
+ const payload1 = {
139
+ id: 5,
140
+ title: 'hi ho',
141
+ content: 'whatever',
142
+ tags: ['a', 'best', 'react'],
143
+ };
144
+
145
+ const payload2 = {
146
+ id: 6,
147
+ title: 'next',
148
+ content: 'my best content yet',
149
+ tags: ['b'],
150
+ };
151
+
152
+ const TestComponent = defineComponent({
153
+ name: 'TestComponent',
154
+ setup() {
155
+ return () => h('div', { id: 'test' }, 'test');
156
+ },
157
+ });
158
+
159
+ const wrapper = mount(TestComponent, {
160
+ global: {
161
+ plugins: [
162
+ [DataClientPlugin],
163
+ [
164
+ MockPlugin,
165
+ {
166
+ fixtures: [
167
+ {
168
+ endpoint: CoolerArticleResource.get,
169
+ args: [{ id: payload1.id }],
170
+ response: payload1,
171
+ },
172
+ {
173
+ endpoint: CoolerArticleResource.get,
174
+ args: [{ id: payload2.id }],
175
+ response: payload2,
176
+ },
177
+ ],
178
+ },
179
+ ],
180
+ ],
181
+ },
182
+ });
183
+
184
+ const controller = wrapper.vm.$dataClient as Controller;
185
+
186
+ // Fetch first fixture
187
+ const result1 = await controller.fetch(CoolerArticleResource.get, {
188
+ id: payload1.id,
189
+ });
190
+ expect(result1.id).toBe(payload1.id);
191
+ expect(result1.title).toBe(payload1.title);
192
+ expect(result1.content).toBe(payload1.content);
193
+ expect(result1.tags).toEqual(payload1.tags);
194
+
195
+ // Fetch second fixture
196
+ const result2 = await controller.fetch(CoolerArticleResource.get, {
197
+ id: payload2.id,
198
+ });
199
+ expect(result2.id).toBe(payload2.id);
200
+ expect(result2.title).toBe(payload2.title);
201
+ expect(result2.content).toBe(payload2.content);
202
+ expect(result2.tags).toEqual(payload2.tags);
203
+
204
+ wrapper.unmount();
205
+ });
206
+
207
+ it('should work with interceptors', async () => {
208
+ const TestComponent = defineComponent({
209
+ name: 'TestComponent',
210
+ setup() {
211
+ return () => h('div', { id: 'test' }, 'test');
212
+ },
213
+ });
214
+
215
+ const wrapper = mount(TestComponent, {
216
+ global: {
217
+ plugins: [
218
+ [DataClientPlugin],
219
+ [
220
+ MockPlugin,
221
+ {
222
+ fixtures: [
223
+ {
224
+ endpoint: CoolerArticleResource.get,
225
+ response: (...args: any[]) => {
226
+ const [{ id }] = args;
227
+ return {
228
+ id,
229
+ title: `Article ${id}`,
230
+ content: 'content',
231
+ tags: [],
232
+ };
233
+ },
234
+ },
235
+ ],
236
+ },
237
+ ],
238
+ ],
239
+ },
240
+ });
241
+
242
+ const controller = wrapper.vm.$dataClient as Controller;
243
+
244
+ // Fetch with interceptor
245
+ const result = await controller.fetch(CoolerArticleResource.get, { id: 7 });
246
+
247
+ expect(result.id).toBe(7);
248
+ expect(result.title).toBe('Article 7');
249
+
250
+ wrapper.unmount();
251
+ });
252
+
253
+ it('should work with getInitialInterceptorData', async () => {
254
+ const TestComponent = defineComponent({
255
+ name: 'TestComponent',
256
+ setup() {
257
+ return () => h('div', { id: 'test' }, 'test');
258
+ },
259
+ });
260
+
261
+ const interceptorData = { count: 0 };
262
+
263
+ const wrapper = mount(TestComponent, {
264
+ global: {
265
+ plugins: [
266
+ [DataClientPlugin],
267
+ [
268
+ MockPlugin,
269
+ {
270
+ fixtures: [
271
+ {
272
+ endpoint: CoolerArticleResource.get,
273
+ response: function (this: { count: number }, ...args: any[]) {
274
+ this.count++;
275
+ const [{ id }] = args;
276
+ return {
277
+ id,
278
+ title: `Article ${id} (call ${this.count})`,
279
+ content: 'content',
280
+ tags: [],
281
+ };
282
+ },
283
+ },
284
+ ],
285
+ getInitialInterceptorData: () => interceptorData,
286
+ },
287
+ ],
288
+ ],
289
+ },
290
+ });
291
+
292
+ const controller = wrapper.vm.$dataClient as Controller;
293
+
294
+ // First fetch
295
+ const result1 = await controller.fetch(CoolerArticleResource.get, {
296
+ id: 8,
297
+ });
298
+ expect(result1.title).toBe('Article 8 (call 1)');
299
+ expect(interceptorData.count).toBe(1);
300
+
301
+ // Second fetch - should increment
302
+ const result2 = await controller.fetch(CoolerArticleResource.get, {
303
+ id: 8,
304
+ });
305
+ expect(result2.title).toBe('Article 8 (call 2)');
306
+ expect(interceptorData.count).toBe(2);
307
+
308
+ wrapper.unmount();
309
+ });
310
+
311
+ it('should override controller provided by DataClientPlugin', () => {
312
+ const TestComponent = defineComponent({
313
+ name: 'TestComponent',
314
+ setup() {
315
+ const controller = inject(ControllerKey);
316
+ const state = inject(StateKey);
317
+ return () =>
318
+ h('div', [
319
+ h('div', { id: 'has-controller' }, controller ? 'yes' : 'no'),
320
+ h('div', { id: 'has-state' }, state ? 'yes' : 'no'),
321
+ ]);
322
+ },
323
+ });
324
+
325
+ const wrapper = mount(TestComponent, {
326
+ global: {
327
+ plugins: [[DataClientPlugin], [MockPlugin, { fixtures: [] }]],
328
+ },
329
+ });
330
+
331
+ expect(wrapper.find('#has-controller').text()).toBe('yes');
332
+ expect(wrapper.find('#has-state').text()).toBe('yes');
333
+
334
+ wrapper.unmount();
335
+ });
336
+
337
+ it('should handle empty fixtures array', () => {
338
+ const TestComponent = defineComponent({
339
+ name: 'TestComponent',
340
+ setup() {
341
+ const controller = inject(ControllerKey);
342
+ return () =>
343
+ h('div', { id: 'has-controller' }, controller ? 'yes' : 'no');
344
+ },
345
+ });
346
+
347
+ const wrapper = mount(TestComponent, {
348
+ global: {
349
+ plugins: [[DataClientPlugin], [MockPlugin, { fixtures: [] }]],
350
+ },
351
+ });
352
+
353
+ expect(wrapper.find('#has-controller').text()).toBe('yes');
354
+
355
+ wrapper.unmount();
356
+ });
357
+
358
+ it('should handle undefined fixtures', () => {
359
+ const TestComponent = defineComponent({
360
+ name: 'TestComponent',
361
+ setup() {
362
+ const controller = inject(ControllerKey);
363
+ return () =>
364
+ h('div', { id: 'has-controller' }, controller ? 'yes' : 'no');
365
+ },
366
+ });
367
+
368
+ const wrapper = mount(TestComponent, {
369
+ global: {
370
+ plugins: [[DataClientPlugin], [MockPlugin, {}]],
371
+ },
372
+ });
373
+
374
+ expect(wrapper.find('#has-controller').text()).toBe('yes');
375
+
376
+ wrapper.unmount();
377
+ });
378
+
379
+ it('should log error when DataClientPlugin is not installed', () => {
380
+ const consoleErrorSpy = jest
381
+ .spyOn(console, 'error')
382
+ .mockImplementation(() => {
383
+ // noop - suppress console.error for this test
384
+ });
385
+
386
+ const TestComponent = defineComponent({
387
+ name: 'TestComponent',
388
+ setup() {
389
+ return () => h('div', 'test');
390
+ },
391
+ });
392
+
393
+ const wrapper = mount(TestComponent, {
394
+ global: {
395
+ plugins: [[MockPlugin, { fixtures: [] }]],
396
+ },
397
+ });
398
+
399
+ expect(consoleErrorSpy).toHaveBeenCalledWith(
400
+ expect.stringContaining(
401
+ 'DataClientPlugin must be installed before MockPlugin',
402
+ ),
403
+ );
404
+
405
+ wrapper.unmount();
406
+ consoleErrorSpy.mockRestore();
407
+ });
408
+
409
+ it('should work with custom managers from DataClientPlugin', () => {
410
+ const customNetworkManager = new NetworkManager();
411
+ const customSubscriptionManager = new SubscriptionManager(
412
+ PollingSubscription,
413
+ );
414
+ const customManagers = [customNetworkManager, customSubscriptionManager];
415
+
416
+ const TestComponent = defineComponent({
417
+ name: 'TestComponent',
418
+ setup() {
419
+ const controller = inject(ControllerKey);
420
+ return () =>
421
+ h('div', { id: 'has-controller' }, controller ? 'yes' : 'no');
422
+ },
423
+ });
424
+
425
+ const wrapper = mount(TestComponent, {
426
+ global: {
427
+ plugins: [
428
+ [DataClientPlugin, { managers: customManagers }],
429
+ [MockPlugin, { fixtures: [] }],
430
+ ],
431
+ },
432
+ });
433
+
434
+ expect(wrapper.find('#has-controller').text()).toBe('yes');
435
+
436
+ wrapper.unmount();
437
+ });
438
+
439
+ it('should work with custom initialState from DataClientPlugin', () => {
440
+ const customState: State<unknown> = {
441
+ entities: {},
442
+ indexes: {},
443
+ endpoints: {},
444
+ meta: {},
445
+ entitiesMeta: {},
446
+ optimistic: [],
447
+ lastReset: Date.now(),
448
+ };
449
+
450
+ const TestComponent = defineComponent({
451
+ name: 'TestComponent',
452
+ setup() {
453
+ const stateRef = inject(StateKey);
454
+ return () =>
455
+ h(
456
+ 'div',
457
+ {
458
+ id: 'last-reset',
459
+ },
460
+ String(stateRef?.value?.lastReset),
461
+ );
462
+ },
463
+ });
464
+
465
+ const wrapper = mount(TestComponent, {
466
+ global: {
467
+ plugins: [
468
+ [DataClientPlugin, { initialState: customState }],
469
+ [MockPlugin, { fixtures: [] }],
470
+ ],
471
+ },
472
+ });
473
+
474
+ expect(wrapper.find('#last-reset').text()).toBe(
475
+ String(customState.lastReset),
476
+ );
477
+
478
+ wrapper.unmount();
479
+ });
480
+
481
+ it('should maintain mocked controller across multiple components', () => {
482
+ const payload = {
483
+ id: 5,
484
+ title: 'hi ho',
485
+ content: 'whatever',
486
+ tags: ['a', 'best', 'react'],
487
+ };
488
+
489
+ const controllers: any[] = [];
490
+
491
+ const createTestComponent = (name: string) =>
492
+ defineComponent({
493
+ name,
494
+ setup() {
495
+ const controller = inject(ControllerKey);
496
+ controllers.push(controller);
497
+ return () => h('div', { id: name.toLowerCase() }, 'test');
498
+ },
499
+ });
500
+
501
+ const ComponentA = createTestComponent('ComponentA');
502
+ const ComponentB = createTestComponent('ComponentB');
503
+ const ComponentC = createTestComponent('ComponentC');
504
+
505
+ const ParentComponent = defineComponent({
506
+ name: 'ParentComponent',
507
+ setup() {
508
+ return () => h('div', [h(ComponentA), h(ComponentB), h(ComponentC)]);
509
+ },
510
+ });
511
+
512
+ const wrapper = mount(ParentComponent, {
513
+ global: {
514
+ plugins: [
515
+ [DataClientPlugin],
516
+ [
517
+ MockPlugin,
518
+ {
519
+ fixtures: [
520
+ {
521
+ endpoint: CoolerArticleResource.get,
522
+ args: [{ id: payload.id }],
523
+ response: payload,
524
+ },
525
+ ],
526
+ },
527
+ ],
528
+ ],
529
+ },
530
+ });
531
+
532
+ // All components should receive the SAME mocked controller instance
533
+ expect(controllers.length).toBe(3);
534
+ expect(controllers[0]).toBe(controllers[1]);
535
+ expect(controllers[1]).toBe(controllers[2]);
536
+
537
+ // Verify it's a mocked controller (has fixtureMap)
538
+ expect((controllers[0] as any).fixtureMap).toBeDefined();
539
+
540
+ wrapper.unmount();
541
+ });
542
+
543
+ it('should update globalProperties.$dataClient with mocked controller', () => {
544
+ const payload = {
545
+ id: 5,
546
+ title: 'hi ho',
547
+ content: 'whatever',
548
+ tags: ['a', 'best', 'react'],
549
+ };
550
+
551
+ const TestComponent = defineComponent({
552
+ name: 'TestComponent',
553
+ setup() {
554
+ return () => h('div', { id: 'test' }, 'test');
555
+ },
556
+ });
557
+
558
+ const wrapper = mount(TestComponent, {
559
+ global: {
560
+ plugins: [
561
+ [DataClientPlugin],
562
+ [
563
+ MockPlugin,
564
+ {
565
+ fixtures: [
566
+ {
567
+ endpoint: CoolerArticleResource.get,
568
+ args: [{ id: payload.id }],
569
+ response: payload,
570
+ },
571
+ ],
572
+ },
573
+ ],
574
+ ],
575
+ },
576
+ });
577
+
578
+ const controller = wrapper.vm.$dataClient as Controller;
579
+
580
+ // Should be a mocked controller (has fixtureMap)
581
+ expect((controller as any).fixtureMap).toBeDefined();
582
+
583
+ wrapper.unmount();
584
+ });
585
+
586
+ it('should work with useSuspense composable', async () => {
587
+ const payload = {
588
+ id: 10,
589
+ title: 'Suspense Test',
590
+ content: 'Testing useSuspense with MockPlugin',
591
+ tags: ['test', 'suspense'],
592
+ };
593
+
594
+ const TestComponent = defineComponent({
595
+ name: 'TestComponent',
596
+ setup() {
597
+ // useSuspense returns a Promise that resolves to a ComputedRef
598
+ const articlePromise = useSuspense(CoolerArticleResource.get, {
599
+ id: payload.id,
600
+ });
601
+ // Store the promise in a ref so we can await it
602
+ const articleRef = shallowRef<any>(null);
603
+ articlePromise.then(article => {
604
+ articleRef.value = article;
605
+ });
606
+ return () => {
607
+ if (!articleRef.value) {
608
+ return h('div', { id: 'loading' }, 'Loading...');
609
+ }
610
+ const article = articleRef.value;
611
+ return h('div', [
612
+ h('div', { id: 'article-id' }, String(article.value.id)),
613
+ h('div', { id: 'article-title' }, article.value.title),
614
+ h('div', { id: 'article-content' }, article.value.content),
615
+ ]);
616
+ };
617
+ },
618
+ });
619
+
620
+ const wrapper = mount(TestComponent, {
621
+ global: {
622
+ plugins: [
623
+ [DataClientPlugin],
624
+ [
625
+ MockPlugin,
626
+ {
627
+ fixtures: [
628
+ {
629
+ endpoint: CoolerArticleResource.get,
630
+ args: [{ id: payload.id }],
631
+ response: payload,
632
+ },
633
+ ],
634
+ },
635
+ ],
636
+ ],
637
+ },
638
+ });
639
+
640
+ // Wait for suspense promise to resolve
641
+ await new Promise(resolve => setTimeout(resolve, 100));
642
+ await wrapper.vm.$nextTick();
643
+
644
+ // Verify the component rendered with the mocked data
645
+ const articleId = wrapper.find('#article-id');
646
+ expect(articleId.exists()).toBe(true);
647
+ expect(articleId.text()).toBe(String(payload.id));
648
+
649
+ const articleTitle = wrapper.find('#article-title');
650
+ expect(articleTitle.exists()).toBe(true);
651
+ expect(articleTitle.text()).toBe(payload.title);
652
+
653
+ const articleContent = wrapper.find('#article-content');
654
+ expect(articleContent.exists()).toBe(true);
655
+ expect(articleContent.text()).toBe(payload.content);
656
+
657
+ wrapper.unmount();
658
+ });
659
+
660
+ it('should work with useQuery composable', async () => {
661
+ const payload = {
662
+ id: 11,
663
+ title: 'Query Test',
664
+ content: 'Testing useQuery with MockPlugin',
665
+ tags: ['test', 'query'],
666
+ };
667
+
668
+ const TestComponent = defineComponent({
669
+ name: 'TestComponent',
670
+ setup() {
671
+ const article = useQuery(CoolerArticleResource.get.schema!, {
672
+ id: payload.id,
673
+ });
674
+ return () =>
675
+ h('div', [
676
+ h(
677
+ 'div',
678
+ { id: 'article-id' },
679
+ article.value ? String(article.value.id) : 'loading',
680
+ ),
681
+ h(
682
+ 'div',
683
+ { id: 'article-title' },
684
+ article.value ? article.value.title : 'loading',
685
+ ),
686
+ ]);
687
+ },
688
+ });
689
+
690
+ const wrapper = mount(TestComponent, {
691
+ global: {
692
+ plugins: [
693
+ [DataClientPlugin],
694
+ [
695
+ MockPlugin,
696
+ {
697
+ fixtures: [
698
+ {
699
+ endpoint: CoolerArticleResource.get,
700
+ args: [{ id: payload.id }],
701
+ response: payload,
702
+ },
703
+ ],
704
+ },
705
+ ],
706
+ ],
707
+ },
708
+ });
709
+
710
+ // Wait for query to resolve
711
+ await wrapper.vm.$nextTick();
712
+ await new Promise(resolve => setTimeout(resolve, 10));
713
+
714
+ // Fetch the data to trigger the query
715
+ const controller = wrapper.vm.$dataClient as Controller;
716
+ await controller.fetch(CoolerArticleResource.get, { id: payload.id });
717
+
718
+ await wrapper.vm.$nextTick();
719
+ await new Promise(resolve => setTimeout(resolve, 10));
720
+
721
+ expect(wrapper.find('#article-id').text()).toBe(String(payload.id));
722
+ expect(wrapper.find('#article-title').text()).toBe(payload.title);
723
+
724
+ wrapper.unmount();
725
+ });
726
+ });