Skip to content

Commit b1b610b

Browse files
author
Kelly Selden
committed
test buildCommand
1 parent 3427b0b commit b1b610b

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

src/get-start-and-end-commands.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,4 @@ async function appendNodeModulesIgnore({
186186
}
187187

188188
module.exports.appendNodeModulesIgnore = appendNodeModulesIgnore;
189+
module.exports.buildCommand = buildCommand;

test/unit/get-start-and-end-commands-test.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ const _getStartAndEndCommands = require('../../src/get-start-and-end-commands');
88
const utils = require('../../src/utils');
99
const loadSafeBlueprint = require('../../src/load-safe-blueprint');
1010

11+
const {
12+
buildCommand
13+
} = _getStartAndEndCommands;
14+
1115
const projectName = 'my-custom-app';
1216
const packageRoot = '/test/package/root';
1317
const 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

Comments
 (0)