@@ -41,12 +41,13 @@ Ims.context.setCli.mockReset()
41
41
Ims . getToken . mockReset ( )
42
42
Ims . getToken . mockResolvedValue ( 'bowling' )
43
43
44
- const yeomanEnvInstantiate = jest . fn ( )
44
+ const yeomanEnvInstantiate = jest . fn ( async ( ) => ( { } ) )
45
+ const yeomanEnvRunGenerator = jest . fn ( )
45
46
const yeomanEnvOptionsGet = jest . fn ( )
46
47
const yeomanEnvOptionsSet = jest . fn ( )
47
48
const createEnvReturnValue = {
48
49
instantiate : yeomanEnvInstantiate ,
49
- runGenerator : jest . fn ( )
50
+ runGenerator : yeomanEnvRunGenerator
50
51
}
51
52
Object . defineProperty ( createEnvReturnValue , 'options' , {
52
53
get : yeomanEnvOptionsGet ,
@@ -146,11 +147,12 @@ describe('run', () => {
146
147
147
148
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
148
149
149
- expect . assertions ( 7 )
150
+ expect . assertions ( 8 )
150
151
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
151
152
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , argPath ] )
152
153
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
153
154
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
155
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
154
156
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
155
157
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
156
158
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -172,11 +174,12 @@ describe('run', () => {
172
174
173
175
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
174
176
175
- expect . assertions ( 7 )
177
+ expect . assertions ( 8 )
176
178
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
177
179
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
178
180
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
179
181
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
182
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
180
183
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
181
184
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
182
185
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -198,11 +201,12 @@ describe('run', () => {
198
201
199
202
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
200
203
201
- expect . assertions ( 7 )
204
+ expect . assertions ( 8 )
202
205
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
203
206
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
204
207
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : true , force : true } } )
205
208
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
209
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
206
210
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
207
211
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
208
212
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -224,11 +228,12 @@ describe('run', () => {
224
228
225
229
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
226
230
227
- expect . assertions ( 7 )
231
+ expect . assertions ( 8 )
228
232
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
229
233
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
230
234
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
231
235
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : true } )
236
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
232
237
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
233
238
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
234
239
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -250,11 +255,12 @@ describe('run', () => {
250
255
251
256
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
252
257
253
- expect . assertions ( 7 )
258
+ expect . assertions ( 8 )
254
259
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
255
260
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
256
261
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
257
262
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
263
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
258
264
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
259
265
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
260
266
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -277,11 +283,12 @@ describe('run', () => {
277
283
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
278
284
getTemplateRequiredServiceNames . mockReturnValueOnce ( [ 'runtime' , 'GraphQLServiceSDK' , 'AssetComputeSDK' ] )
279
285
280
- expect . assertions ( 8 )
286
+ expect . assertions ( 9 )
281
287
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
282
288
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
283
289
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
284
290
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
291
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
285
292
expect ( mockTemplateHandlerInstance . installTemplate ) . not . toHaveBeenCalled ( )
286
293
expect ( getTemplateRequiredServiceNames ) . toHaveBeenCalledWith ( templateName )
287
294
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -305,11 +312,12 @@ describe('run', () => {
305
312
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
306
313
getTemplateRequiredServiceNames . mockReturnValueOnce ( [ ] )
307
314
308
- expect . assertions ( 7 )
315
+ expect . assertions ( 8 )
309
316
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
310
317
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
311
318
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
312
319
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
320
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
313
321
expect ( mockTemplateHandlerInstance . installTemplate ) . not . toHaveBeenCalled ( )
314
322
expect ( getTemplateRequiredServiceNames ) . toHaveBeenCalledWith ( templateName )
315
323
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
@@ -334,11 +342,12 @@ describe('run', () => {
334
342
335
343
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
336
344
337
- expect . assertions ( 7 )
345
+ expect . assertions ( 8 )
338
346
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
339
347
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , templateName ] )
340
348
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
341
349
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
350
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
342
351
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
343
352
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
344
353
expect ( writeObjectToPackageJson ) . not . toHaveBeenCalled ( )
@@ -377,11 +386,12 @@ describe('template-options', () => {
377
386
378
387
getNpmDependency . mockResolvedValueOnce ( [ templateName , '1.0.0' ] )
379
388
380
- expect . assertions ( 7 )
389
+ expect . assertions ( 8 )
381
390
await expect ( command . run ( ) ) . resolves . toBeUndefined ( )
382
391
expect ( runScript ) . toHaveBeenCalledWith ( 'npm' , process . cwd ( ) , [ 'install' , argPath ] )
383
392
expect ( yeomanEnvInstantiate ) . toHaveBeenCalledWith ( expect . any ( Object ) , { options : { 'skip-prompt' : false , force : true } } )
384
393
expect ( yeomanEnvOptionsSet ) . toHaveBeenCalledWith ( { skipInstall : false } )
394
+ expect ( yeomanEnvRunGenerator ) . toHaveBeenCalledWith ( expect . any ( Object ) )
385
395
expect ( mockTemplateHandlerInstance . installTemplate ) . toHaveBeenCalledWith ( 'org-id' , 'project-id' )
386
396
expect ( getTemplateRequiredServiceNames ) . not . toHaveBeenCalled ( )
387
397
expect ( writeObjectToPackageJson ) . toHaveBeenCalledWith ( {
0 commit comments