Skip to content

Commit

Permalink
Added unit tests for buildPrefixRegexps() #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sthzg committed Jul 8, 2016
1 parent 9d9dbb0 commit 55c806f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/utils/utilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ describe('getPkgInfo()', () => {
});


describe('buildPrefixRegexps()', () => {
it('returns expected regexps', function () {
let regexps = utils.buildPrefixRegexps(['contrib-subgen-', 'subgen-'], 'foobar');
chai.equal(regexps.length, 2);
chai.equal(regexps[0], '/^contrib-subgen-foobar-/');
chai.equal(regexps[1], '/^subgen-foobar-/');
});

it('returns expected basename for subgen-foobar-helloworld', function () {
let bn = utils.getSubgenBaseName('foobar', ['contrib-subgen-', 'subgen-'], 'subgen-foobar-helloworld');
chai.equal(bn, 'helloworld');
});
});


describe('getSubgenBaseName()', () => {
it('returns expected basename for contrib-subgen-foobar-helloworld', function () {
let bn = utils.getSubgenBaseName('foobar', ['contrib-subgen-', 'subgen-'], 'contrib-subgen-foobar-helloworld');
Expand All @@ -98,3 +113,13 @@ describe('getSubgenBaseName()', () => {
chai.equal(bn, 'helloworld');
});
});


// TODO
describe('checkActivationState()', () => {
});


// TODO
describe('findExternalSubgens()', () => {
});
1 change: 1 addition & 0 deletions utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function sortCharArrByLength(arr, desc=true) {


module.exports = {
buildPrefixRegexps,
checkActivationState,
checkPkgExists,
getPkgInfo,
Expand Down

0 comments on commit 55c806f

Please sign in to comment.