Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Having runCommand return a boolean #277

Merged
merged 3 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ module.exports = {
require('./cli/version')();
break;
default:
logger.info('@blackbaud/skyux-builder: Unknown command %s', command);
break;
return false;
}

return true;
}
};
15 changes: 9 additions & 6 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ describe('@blackbaud/skyux-builder', () => {
});
});

it('should handle unknown command', () => {
it('should return false for unknown command', () => {
spyOn(logger, 'info');
const cmd = 'junk-command-that-does-not-exist';
const lib = require('../index');
lib.runCommand(cmd, {});
expect(logger.info).toHaveBeenCalledWith(
'@blackbaud/skyux-builder: Unknown command %s',
cmd
);
expect(lib.runCommand(cmd, {})).toBe(false);
});

it('should return true for known command', () => {
spyOn(logger, 'info');
const cmd = 'version';
const lib = require('../index');
expect(lib.runCommand(cmd, {})).toBe(true);
});

it('should process shorthand tags', (done) => {
Expand Down