Skip to content

Commit 6f31a40

Browse files
author
Kelly Selden
committed
add test for two layer custom blueprints
1 parent 18bcade commit 6f31a40

File tree

1 file changed

+58
-6
lines changed

1 file changed

+58
-6
lines changed

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

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const {
1616
const projectName = 'my-custom-app';
1717
const startVersion = '0.0.1';
1818
const endVersion = '0.0.2';
19+
const baseVersion = '0.0.3';
1920
const packageRoot = '/test/package/root';
2021
const packageVersion = startVersion;
2122
const cwd = '/test/cwd';
@@ -24,7 +25,7 @@ const commandName = 'ember';
2425
const blueprint = 'test-blueprint';
2526
const blueprintPath = '/path/to/blueprint';
2627
const projectPath = path.normalize(`${cwd}/${projectName}`);
27-
const baseBlueprint = loadDefaultBlueprint([], '0.0.3');
28+
const baseBlueprint = loadDefaultBlueprint([], baseVersion);
2829
const defaultStartBlueprint = loadDefaultBlueprint([], startVersion);
2930
const defaultEndBlueprint = loadDefaultBlueprint([], endVersion);
3031

@@ -265,7 +266,7 @@ describe(_getStartAndEndCommands, function() {
265266
});
266267

267268
describe('custom blueprint', function() {
268-
it('returns an options object', async function() {
269+
it('returns an options object - base default', async function() {
269270
let options = getStartAndEndCommands({
270271
baseBlueprint,
271272
startBlueprint: {
@@ -294,15 +295,66 @@ describe(_getStartAndEndCommands, function() {
294295
name: blueprint,
295296
version: startVersion
296297
},
297-
packageRange: '0.0.3'
298+
packageRange: baseVersion
298299
},
299300
endOptions: {
300301
baseBlueprint,
301302
blueprint: {
302303
name: blueprint,
303304
version: endVersion
304305
},
305-
packageRange: '0.0.3'
306+
packageRange: baseVersion
307+
}
308+
});
309+
});
310+
311+
it('returns an options object - base custom', async function() {
312+
let options = getStartAndEndCommands({
313+
baseBlueprint: {
314+
version: baseVersion,
315+
isBaseBlueprint: true
316+
},
317+
startBlueprint: {
318+
name: blueprint,
319+
version: startVersion
320+
},
321+
endBlueprint: {
322+
name: blueprint,
323+
version: endVersion
324+
}
325+
});
326+
327+
expect(options.createProjectFromCache).to.be.a('function');
328+
expect(options.createProjectFromRemote).to.be.a('function');
329+
330+
delete options.createProjectFromCache;
331+
delete options.createProjectFromRemote;
332+
333+
expect(options).to.deep.equal({
334+
projectName,
335+
packageName,
336+
commandName,
337+
startOptions: {
338+
baseBlueprint: {
339+
version: baseVersion,
340+
isBaseBlueprint: true
341+
},
342+
blueprint: {
343+
name: blueprint,
344+
version: startVersion
345+
},
346+
packageRange: ''
347+
},
348+
endOptions: {
349+
baseBlueprint: {
350+
version: baseVersion,
351+
isBaseBlueprint: true
352+
},
353+
blueprint: {
354+
name: blueprint,
355+
version: endVersion
356+
},
357+
packageRange: ''
306358
}
307359
});
308360
});
@@ -682,15 +734,15 @@ describe(_getStartAndEndCommands, function() {
682734
startOptions: {
683735
baseBlueprint,
684736
blueprint: null,
685-
packageRange: '0.0.3'
737+
packageRange: baseVersion
686738
},
687739
endOptions: {
688740
baseBlueprint,
689741
blueprint: {
690742
name: blueprint,
691743
version: endVersion
692744
},
693-
packageRange: '0.0.3'
745+
packageRange: baseVersion
694746
}
695747
});
696748
});

0 commit comments

Comments
 (0)