@@ -210,6 +210,82 @@ describe('Lightning component creation tests:', () => {
210
210
) ;
211
211
} ) ;
212
212
213
+ describe ( 'Check analytics dashboard lwc creation' , ( ) => {
214
+ test
215
+ . withOrg ( )
216
+ . withProject ( )
217
+ . stdout ( )
218
+ . command ( [
219
+ 'force:lightning:component:create' ,
220
+ '--componentname' ,
221
+ 'foo' ,
222
+ '--outputdir' ,
223
+ 'lwc' ,
224
+ '--type' ,
225
+ 'lwc' ,
226
+ '--template' ,
227
+ 'analyticsDashboard'
228
+ ] )
229
+ . it (
230
+ 'should create analyticsDashboard lwc files in the lwc output directory' ,
231
+ ctx => {
232
+ const jsFile = path . join ( 'lwc' , 'foo' , 'foo.js' ) ;
233
+ const metaFile = path . join ( 'lwc' , 'foo' , 'foo.js-meta.xml' ) ;
234
+ assert . file ( metaFile ) ;
235
+ assert . file ( path . join ( 'lwc' , 'foo' , 'foo.html' ) ) ;
236
+ assert . file ( jsFile ) ;
237
+ assert . fileContent ( metaFile , '<target>analytics__Dashboard</target>' ) ;
238
+ assert . fileContent ( metaFile , 'targets="analytics__Dashboard"' ) ;
239
+ assert . fileContent ( metaFile , '<hasStep>false</hasStep>' ) ;
240
+ assert . fileContent (
241
+ jsFile ,
242
+ 'export default class Foo extends LightningElement {'
243
+ ) ;
244
+ assert . fileContent ( jsFile , '@api getState;' ) ;
245
+ assert . fileContent ( jsFile , '@api setState;' ) ;
246
+ }
247
+ ) ;
248
+ test
249
+ . withOrg ( )
250
+ . withProject ( )
251
+ . stdout ( )
252
+ . command ( [
253
+ 'force:lightning:component:create' ,
254
+ '--componentname' ,
255
+ 'foo' ,
256
+ '--outputdir' ,
257
+ 'lwc' ,
258
+ '--type' ,
259
+ 'lwc' ,
260
+ '--template' ,
261
+ 'analyticsDashboardWithStep'
262
+ ] )
263
+ . it (
264
+ 'should create analyticsDashboardWithStep lwc files in the lwc output directory' ,
265
+ ctx => {
266
+ const jsFile = path . join ( 'lwc' , 'foo' , 'foo.js' ) ;
267
+ const metaFile = path . join ( 'lwc' , 'foo' , 'foo.js-meta.xml' ) ;
268
+ assert . file ( metaFile ) ;
269
+ assert . file ( path . join ( 'lwc' , 'foo' , 'foo.html' ) ) ;
270
+ assert . file ( jsFile ) ;
271
+ assert . fileContent ( metaFile , '<target>analytics__Dashboard</target>' ) ;
272
+ assert . fileContent ( metaFile , 'targets="analytics__Dashboard"' ) ;
273
+ assert . fileContent ( metaFile , '<hasStep>true</hasStep>' ) ;
274
+ assert . fileContent (
275
+ jsFile ,
276
+ 'export default class Foo extends LightningElement {'
277
+ ) ;
278
+ assert . fileContent ( jsFile , '@api getState;' ) ;
279
+ assert . fileContent ( jsFile , '@api setState;' ) ;
280
+ assert . fileContent ( jsFile , '@api results;' ) ;
281
+ assert . fileContent ( jsFile , '@api metadata;' ) ;
282
+ assert . fileContent ( jsFile , '@api selection;' ) ;
283
+ assert . fileContent ( jsFile , '@api setSelection;' ) ;
284
+ assert . fileContent ( jsFile , '@api selectMode;' ) ;
285
+ }
286
+ ) ;
287
+ } ) ;
288
+
213
289
describe ( 'lightning component failures' , ( ) => {
214
290
test
215
291
. withOrg ( )
@@ -261,5 +337,28 @@ describe('Lightning component creation tests:', () => {
261
337
. it ( 'should throw invalid template error' , ctx => {
262
338
expect ( ctx . stderr ) . to . contain ( messages . getMessage ( 'InvalidTemplate' ) ) ;
263
339
} ) ;
340
+ test
341
+ . withOrg ( )
342
+ . withProject ( )
343
+ . stderr ( )
344
+ . command ( [
345
+ 'force:lightning:component:create' ,
346
+ '--outputdir' ,
347
+ 'aura' ,
348
+ '--componentname' ,
349
+ 'foo' ,
350
+ '--type' ,
351
+ 'aura' ,
352
+ '--template' ,
353
+ 'analyticsDashboard'
354
+ ] )
355
+ . it ( 'should throw missing template error' , ctx => {
356
+ expect ( ctx . stderr ) . to . contain (
357
+ messages . getMessage ( 'MissingLightningComponentTemplate' , [
358
+ 'analyticsDashboard' ,
359
+ 'aura'
360
+ ] )
361
+ ) ;
362
+ } ) ;
264
363
} ) ;
265
364
} ) ;
0 commit comments