@@ -8,6 +8,10 @@ const _getStartAndEndCommands = require('../../src/get-start-and-end-commands');
88const utils = require ( '../../src/utils' ) ;
99const loadSafeBlueprint = require ( '../../src/load-safe-blueprint' ) ;
1010
11+ const {
12+ buildCommand
13+ } = _getStartAndEndCommands ;
14+
1115const projectName = 'my-custom-app' ;
1216const packageRoot = '/test/package/root' ;
1317const packageVersion = '0.0.1' ;
@@ -384,4 +388,59 @@ describe(_getStartAndEndCommands, function() {
384388 expect ( await processBlueprint ( { options : [ '--yarn' ] } ) ) . to . include ( '--yarn' ) ;
385389 } ) ;
386390 } ) ;
391+
392+ describe ( buildCommand , function ( ) {
393+ let projectName = 'my-project' ;
394+
395+ it ( 'works for default app' , function ( ) {
396+ let blueprint = {
397+ name : 'ember-cli' ,
398+ type : 'app' ,
399+ options : [ ]
400+ } ;
401+
402+ let command = buildCommand ( projectName , blueprint ) ;
403+
404+ expect ( command ) . to . equal ( 'new my-project -sn -sg' ) ;
405+ } ) ;
406+
407+ it ( 'works for default addon' , function ( ) {
408+ let blueprint = {
409+ name : 'ember-cli' ,
410+ type : 'addon' ,
411+ options : [ ]
412+ } ;
413+
414+ let command = buildCommand ( projectName , blueprint ) ;
415+
416+ expect ( command ) . to . equal ( 'addon my-project -sn -sg' ) ;
417+ } ) ;
418+
419+ it ( 'works for custom app' , function ( ) {
420+ let blueprint = {
421+ name : 'my-blueprint' ,
422+ path : '/path/to/my-blueprint' ,
423+ options : [ ]
424+ } ;
425+
426+ let command = buildCommand ( projectName , blueprint ) ;
427+
428+ expect ( command ) . to . equal ( 'new my-project -sn -sg -b /path/to/my-blueprint' ) ;
429+ } ) ;
430+
431+ it ( 'handles options' , function ( ) {
432+ let blueprint = {
433+ name : 'ember-cli' ,
434+ type : 'app' ,
435+ options : [
436+ '--my-option-1' ,
437+ '--my-option-2'
438+ ]
439+ } ;
440+
441+ let command = buildCommand ( projectName , blueprint ) ;
442+
443+ expect ( command ) . to . equal ( 'new my-project -sn -sg --my-option-1 --my-option-2' ) ;
444+ } ) ;
445+ } ) ;
387446} ) ;
0 commit comments