Skip to content

Commit 468ac0f

Browse files
author
Kelly Selden
committed
add assertion for accidental non-base blueprint
1 parent 6f31a40 commit 468ac0f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ module.exports = function getStartAndEndCommands({
2121
startBlueprint,
2222
endBlueprint
2323
}) {
24+
if (baseBlueprint && !baseBlueprint.isBaseBlueprint) {
25+
throw new Error('The intended base blueprint is not actually a base blueprint.');
26+
}
27+
2428
if (endBlueprint.isBaseBlueprint && baseBlueprint) {
2529
throw new Error('You supplied two layers of base blueprints.');
2630
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ describe(_getStartAndEndCommands, function() {
5656
}, options));
5757
}
5858

59+
it('throws if base blueprint is not marked as such', function() {
60+
let f = () => getStartAndEndCommands({
61+
baseBlueprint: {}
62+
});
63+
64+
expect(f).to.throw('The intended base blueprint is not actually a base blueprint.');
65+
});
66+
5967
it('throws if two layers of base blueprints', function() {
6068
let f = () => getStartAndEndCommands({
6169
baseBlueprint

0 commit comments

Comments
 (0)