File size: 16,940 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/**
 * @jest-environment jsdom
 */
import { createActions } from '../actions';
import {
	SiteLaunchError,
	AtomicTransferError,
	LatestAtomicTransfer,
	LatestAtomicTransferError,
	AtomicSoftwareStatus,
} from '../types';

const client_id = 'magic_client_id';
const client_secret = 'magic_client_secret';
const mockedClientCredentials = { client_id, client_secret };
const siteId = 12345;
const error = SiteLaunchError.INTERNAL;
const atomicTransferError = AtomicTransferError.INTERNAL;
const latestAtomicTransferError: LatestAtomicTransferError = {
	name: 'NotFoundError',
	status: 404,
	message: 'Transfer not found',
	code: 'no_transfer_error',
};

const siteSlug = 'test.wordpress.com';
const pluginSlug = 'woocommerce';

describe( 'Site Actions', () => {
	describe( 'Bundled Plugin Actions', () => {
		it( 'should return a SET_BUNDLED_PLUGIN_SLUG Action', () => {
			const { setBundledPluginSlug } = createActions( mockedClientCredentials );
			const expected = {
				type: 'SET_BUNDLED_PLUGIN_SLUG',
				siteSlug,
				pluginSlug,
			};

			expect( setBundledPluginSlug( siteSlug, pluginSlug ) ).toEqual( expected );
		} );
	} );
	describe( 'Site Theme Actions', () => {
		it( 'should return a RECEIVE_SITE_THEME Action', () => {
			const siteId = 12345;
			const theme = {
				id: 'tazza',
			};
			const { receiveSiteTheme } = createActions( mockedClientCredentials );
			const expected = {
				type: 'RECEIVE_SITE_THEME',
				siteId,
				theme,
			};

			expect( receiveSiteTheme( siteId, theme ) ).toEqual( expected );
		} );
	} );
	describe( 'LAUNCH_SITE Actions', () => {
		it( 'should return a LAUNCH_SITE_START Action', () => {
			const { launchSiteStart } = createActions( mockedClientCredentials );

			const expected = {
				type: 'LAUNCH_SITE_START',
				siteId,
			};

			expect( launchSiteStart( siteId ) ).toEqual( expected );
		} );

		it( 'should return a LAUNCH_SITE_SUCCESS Action', () => {
			const { launchSiteSuccess } = createActions( mockedClientCredentials );

			const expected = {
				type: 'LAUNCH_SITE_SUCCESS',
				siteId,
			};

			expect( launchSiteSuccess( siteId ) ).toEqual( expected );
		} );

		it( 'should return a LAUNCH_SITE_FAILURE Action', () => {
			const { launchSiteFailure } = createActions( mockedClientCredentials );

			const expected = {
				type: 'LAUNCH_SITE_FAILURE',
				siteId,
				error,
			};

			expect( launchSiteFailure( siteId, error ) ).toEqual( expected );
		} );

		it( 'should launch a site successfully', () => {
			const { launchSite } = createActions( mockedClientCredentials );
			const generator = launchSite( siteId );

			const mockedApiResponse = {
				request: {
					apiVersion: '1.1',
					method: 'post',
					path: `/sites/${ siteId }/launch`,
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: LAUNCH_SITE_IDLE is fired
			expect( generator.next().value ).toEqual( {
				type: 'LAUNCH_SITE_START',
				siteId,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: LAUNCH_SITE_SUCCESS is fired
			expect( generator.next().value ).toEqual( {
				type: 'LAUNCH_SITE_SUCCESS',
				siteId,
			} );
		} );

		it( 'should fail to launch a site', () => {
			const { launchSite } = createActions( mockedClientCredentials );
			const generator = launchSite( siteId );

			const mockedApiResponse = {
				request: {
					apiVersion: '1.1',
					method: 'post',
					path: `/sites/${ siteId }/launch`,
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: LAUNCH_SITE_IDLE is fired
			expect( generator.next().value ).toEqual( {
				type: 'LAUNCH_SITE_START',
				siteId,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: Throw an error
			expect( generator.throw( error ).value ).toEqual( {
				type: 'LAUNCH_SITE_FAILURE',
				siteId,
				error,
			} );

			// Fourth iteration: Complete the cycle
			const finalResult = generator.next();

			expect( finalResult.value ).toBeFalsy();
			expect( finalResult.done ).toBe( true );
		} );
	} );

	describe( 'Atomic Actions', () => {
		it( 'should return a ATOMIC_TRANSFER_START Action', () => {
			const { atomicTransferStart } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const transferIntent = 'migrate';

			const expected = {
				type: 'ATOMIC_TRANSFER_START',
				siteId,
				softwareSet,
				transferIntent,
			};

			expect( atomicTransferStart( siteId, softwareSet, transferIntent ) ).toEqual( expected );
		} );

		it( 'should return a ATOMIC_TRANSFER_SUCCESS Action', () => {
			const { atomicTransferSuccess } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const transferIntent = 'migrate';

			const expected = {
				type: 'ATOMIC_TRANSFER_SUCCESS',
				siteId,
				softwareSet,
				transferIntent,
			};

			expect( atomicTransferSuccess( siteId, softwareSet, transferIntent ) ).toEqual( expected );
		} );

		it( 'should return a ATOMIC_TRANSFER_FAILURE Action', () => {
			const { atomicTransferFailure } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';

			const expected = {
				type: 'ATOMIC_TRANSFER_FAILURE',
				siteId,
				softwareSet,
				error: atomicTransferError,
			};

			expect( atomicTransferFailure( siteId, softwareSet, atomicTransferError ) ).toEqual(
				expected
			);
		} );

		it( 'should start an Atomic transfer', () => {
			const { initiateAtomicTransfer } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const transferIntent = 'migrate';
			const generator = initiateAtomicTransfer( siteId, softwareSet, transferIntent );

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'POST',
					path: `/sites/${ siteId }/atomic/transfers`,
					body: {
						software_set: softwareSet,
						context: 'woo-on-plans',
						transfer_intent: transferIntent,
					},
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: ATOMIC_TRANSFER_START is fired
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_TRANSFER_START',
				siteId,
				softwareSet,
				transferIntent,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: ATOMIC_TRANSFER_SUCCESS is fired
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_TRANSFER_SUCCESS',
				siteId,
				softwareSet,
				transferIntent,
			} );
		} );
		it( 'should fail to transfer a site to Atomic', () => {
			const { initiateAtomicTransfer } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const transferIntent = 'migrate';
			const generator = initiateAtomicTransfer( siteId, softwareSet, transferIntent );

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'POST',
					path: `/sites/${ siteId }/atomic/transfers`,
					body: {
						software_set: softwareSet,
						context: 'woo-on-plans',
						transfer_intent: transferIntent,
					},
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: ATOMIC_TRANSFER_START is fired
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_TRANSFER_START',
				siteId,
				softwareSet,
				transferIntent,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: ATOMIC_TRANSFER_FAILURE is fired
			expect( generator.throw( atomicTransferError ).value ).toEqual( {
				type: 'ATOMIC_TRANSFER_FAILURE',
				siteId,
				softwareSet,
				error: atomicTransferError,
			} );
		} );

		it( 'should request succesfully the Atomic transfer status', () => {
			const { requestLatestAtomicTransfer } = createActions( mockedClientCredentials );
			const generator = requestLatestAtomicTransfer( siteId );
			const transfer: LatestAtomicTransfer = {
				atomic_transfer_id: 123,
				blog_id: 12345,
				status: 'SUCCESS',
				created_at: 'now',
				is_stuck: false,
				is_stuck_reset: false,
				in_lossless_revert: false,
			};

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'GET',
					path: `/sites/${ siteId }/atomic/transfers/latest`,
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: LATEST_ATOMIC_TRANSFER_START is fired
			expect( generator.next().value ).toEqual( {
				type: 'LATEST_ATOMIC_TRANSFER_START',
				siteId,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: ATOMIC_TRANSFER_SUCCESS is fired
			expect( generator.next( transfer ).value ).toEqual( {
				type: 'LATEST_ATOMIC_TRANSFER_SUCCESS',
				siteId,
				transfer,
			} );
		} );

		it( 'should request the Atomic transfer status and fail', () => {
			const { requestLatestAtomicTransfer } = createActions( mockedClientCredentials );
			const generator = requestLatestAtomicTransfer( siteId );

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'GET',
					path: `/sites/${ siteId }/atomic/transfers/latest`,
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: LATEST_ATOMIC_TRANSFER_START is fired
			expect( generator.next().value ).toEqual( {
				type: 'LATEST_ATOMIC_TRANSFER_START',
				siteId,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: LATEST_ATOMIC_TRANSFER_FAILURE is fired
			expect( generator.throw( latestAtomicTransferError ).value ).toEqual( {
				type: 'LATEST_ATOMIC_TRANSFER_FAILURE',
				siteId,
				error: latestAtomicTransferError,
			} );
		} );

		it( 'should request the Atomic software install status succesfully', () => {
			const { requestAtomicSoftwareStatus } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const generator = requestAtomicSoftwareStatus( siteId, softwareSet );
			const status: AtomicSoftwareStatus = {
				blog_id: 123,
				software_set: {
					test: { path: '/valid_path.php', state: 'activate' },
				},
				applied: false,
			};

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'GET',
					path: `/sites/${ siteId }/atomic/software/${ softwareSet }`,
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_SOFTWARE_STATUS_START',
				siteId,
				softwareSet,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: LATEST_ATOMIC_TRANSFER_SUCCESS is fired
			expect( generator.next( status ).value ).toEqual( {
				type: 'ATOMIC_SOFTWARE_STATUS_SUCCESS',
				siteId,
				softwareSet,
				status,
			} );
		} );
		it( 'should start an Atomic software install', () => {
			const { initiateSoftwareInstall } = createActions( mockedClientCredentials );
			const softwareSet = 'woo-on-plans';
			const generator = initiateSoftwareInstall( siteId, softwareSet );

			const mockedApiResponse = {
				request: {
					apiNamespace: 'wpcom/v2',
					method: 'POST',
					path: `/sites/${ siteId }/atomic/software/${ softwareSet }`,
					body: {},
				},
				type: 'WPCOM_REQUEST',
			};

			// First iteration: ATOMIC_SOFTWARE_INSTALL_START is fired
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_SOFTWARE_INSTALL_START',
				siteId,
				softwareSet,
			} );

			// Second iteration: WP_COM_REQUEST is fired
			expect( generator.next().value ).toEqual( mockedApiResponse );

			// Third iteration: ATOMIC_SOFTWARE_INSTALL_SUCCESS is fired
			expect( generator.next().value ).toEqual( {
				type: 'ATOMIC_SOFTWARE_INSTALL_SUCCESS',
				siteId,
				softwareSet,
			} );
		} );
	} );

	describe( 'Design Actions', () => {
		const mockedRecipe = { stylesheet: 'pub/zoologist' };
		const mockedGlobalStylesId = 1;
		const mockedDesign = {
			title: 'Zoologist',
			slug: 'zoologist',
			template: 'zoologist',
			theme: 'zoologist',
			categories: [ { slug: 'featured', name: 'Featured' } ],
			features: [],
			recipe: mockedRecipe,
		};
		const mockedStyleVariation = {
			title: 'Parrot',
			slug: 'parrot',
			settings: {
				color: {
					palette: {
						theme: [
							{
								color: '#FF0000',
								name: 'Red',
								slug: 'red',
							},
						],
					},
				},
			},
			styles: {
				spacing: {
					blockGap: '0.5rem',
				},
			},
		};
		const mockedDefaultVariation = {
			title: 'Default',
			slug: 'default',
			settings: {
				color: {
					palette: {
						theme: [
							{
								color: '#880000',
								name: 'Red',
								slug: 'red',
							},
						],
					},
				},
			},
			styles: {
				spacing: {
					blockGap: '1rem',
				},
			},
		};

		const createMockedThemeSwitchApiRequest = ( payload ) => ( {
			type: 'WPCOM_REQUEST',
			request: {
				path: `/sites/${ siteSlug }/themes/mine?_locale=user`,
				apiVersion: '1.1',
				body: payload,
				method: 'POST',
			},
		} );

		const createMockedGetGlobalStylesApiRequest = ( stylesheet ) => ( {
			type: 'WPCOM_REQUEST',
			request: {
				path: `/sites/${ siteSlug }/global-styles/themes/${ stylesheet }/variations`,
				apiNamespace: 'wp/v2',
				method: 'GET',
			},
		} );

		const createMockedSetGlobalStylesApiRequest = ( globalStylesId, payload ) => ( {
			type: 'WPCOM_REQUEST',
			request: {
				path: `/sites/${ siteSlug }/global-styles/${ globalStylesId }`,
				apiNamespace: 'wp/v2',
				body: payload,
				method: 'POST',
			},
		} );

		const createMockedThemeSetupApiRequest = () => ( {
			type: 'WPCOM_REQUEST',
			request: {
				path: `/sites/${ siteSlug }/theme-setup/?_locale=user`,
				apiNamespace: 'wpcom/v2',
				method: 'POST',
			},
		} );

		it( 'should call global styles API to set the styles if the design has style variation', () => {
			const { setDesignOnSite } = createActions( mockedClientCredentials );
			const generator = setDesignOnSite( siteSlug, mockedDesign, {
				styleVariation: mockedStyleVariation,
			} );

			// 1st iteration: WP_COM_REQUEST to /sites/${ siteSlug }/themes/mine is fired
			expect( generator.next().value ).toEqual(
				createMockedThemeSwitchApiRequest( {
					theme: 'zoologist',
				} )
			);

			// 2nd iteration: WP_COM_REQUEST to /sites/${ siteSlug }/global-styles/themes/${ stylesheet }/variations is fired
			expect(
				generator.next( {
					stylesheet: mockedDesign.recipe.stylesheet,
					global_styles_id: mockedGlobalStylesId,
				} as any ).value
			).toEqual( createMockedGetGlobalStylesApiRequest( mockedDesign.recipe.stylesheet ) );

			// 3rd iteration: WP_COM_REQUEST to /sites/${ siteSlug }/global-styles/${ globalStylesId } is fired
			expect( generator.next( [ mockedStyleVariation ] as any ).value ).toEqual(
				createMockedSetGlobalStylesApiRequest( mockedGlobalStylesId, {
					id: mockedGlobalStylesId,
					settings: mockedStyleVariation.settings,
					styles: mockedStyleVariation.styles,
				} )
			);
		} );

		it( 'should call global styles API to reset styles when user selects default variation', () => {
			const { setDesignOnSite } = createActions( mockedClientCredentials );
			const generator = setDesignOnSite( siteSlug, mockedDesign, {
				styleVariation: mockedDefaultVariation,
			} );

			// 1st iteration: WP_COM_REQUEST to /sites/${ siteSlug }/themes/mine is fired
			expect( generator.next().value ).toEqual(
				createMockedThemeSwitchApiRequest( {
					theme: 'zoologist',
				} )
			);

			// 2nd iteration: WP_COM_REQUEST to /sites/${ siteSlug }/global-styles/${ globalStylesId } is fired
			expect(
				generator.next( {
					stylesheet: mockedDesign.recipe.stylesheet,
					global_styles_id: mockedGlobalStylesId,
				} ).value
			).toEqual(
				createMockedSetGlobalStylesApiRequest( mockedGlobalStylesId, {
					id: mockedGlobalStylesId,
					// Resetting styles means these values are empty, regrdless of the base styles
					// specified in the `mockedDefaultVariation` object.
					settings: {},
					styles: {},
				} )
			);
		} );

		it( 'should call theme-setup api', () => {
			const { setDesignOnSite } = createActions( mockedClientCredentials );
			const generator = setDesignOnSite(
				siteSlug,
				{
					...mockedDesign,
					slug: 'arbutus',
				},
				{
					enableThemeSetup: true,
				}
			);

			// First iteration: WP_COM_REQUEST to /sites/${ siteSlug }/themes/mine is fired
			expect( generator.next().value ).toEqual(
				createMockedThemeSwitchApiRequest( {
					theme: 'arbutus',
				} )
			);

			// Second iteration: WP_COM_REQUEST to /sites/${ siteSlug }/theme-setup is fired
			expect( generator.next( {} ).value ).toEqual( createMockedThemeSetupApiRequest() );

			// Second iteration: Complete the cycle
			expect( generator.next().done ).toEqual( true );
		} );
	} );
} );