Skip to content

Commit

Permalink
Added unit tests for checkActivationState() #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sthzg committed Jul 8, 2016
1 parent 55c806f commit 2c257b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 3 additions & 2 deletions test/_helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ const mockedDirsForSearchPaths = {
structure: {
'/tmp/searchPath1': {
'sp1dir1': {
'foo': {},
'bar': {},
'generators': {
'hello': {}
},
'package.json': JSON.stringify({
name: 'sp1dir1pkg',
version: '1.0.0'
Expand Down
24 changes: 23 additions & 1 deletion test/utils/utilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,30 @@ describe('getSubgenBaseName()', () => {
});


// TODO
describe('checkActivationState()', () => {
describe('with mocked file system', function () {
before(function () {
mockfs(tHelpers.mockedDirsForSearchPaths.structure);
const pkgPaths = utils.getInstalledPkgPaths(tHelpers.mockedDirsForSearchPaths.roots);
this.store = utils.populatePkgStoreFromPaths(pkgPaths);
});

it('reports activated subgen', function () {
const hostPkg = utils.getPkgInfo('sp1dir1', this.store).pkg;
const res = utils.checkActivationState(hostPkg, 'hello');
chai.ok(res.result);
});

it('reports deactiaved', function () {
const hostPkg = utils.getPkgInfo('sp1dir1', this.store).pkg;
const res = utils.checkActivationState(hostPkg, 'nonExistent');
chai.notOk(res.result);
});

after(function () {
mockfs.restore();
});
});
});


Expand Down

0 comments on commit 2c257b2

Please sign in to comment.