Skip to content

Commit

Permalink
Rebased unit tests to changes in develop branch #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sthzg committed Jul 8, 2016
1 parent c190dd0 commit 4871fce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

2016-07-08
- <@sthzg> added coveralls integration
- <@sthzg> added coverage by running npm run test:covarage
- <@sthzg> added basic set of unit tests for utils.js
- <@stylesuxx> added immutable Message and Package records

2016-07-07
Expand Down
26 changes: 13 additions & 13 deletions test/utils/utilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ describe('getPkgInfo()', () => {
it('returns data from package.json', function () {
const pkgQ = utils.getPkgInfo('sp1dir1', this.store);
chai.equal(pkgQ.hasError, false);
chai.equal(pkgQ.pkg.version, '1.0.0');
chai.equal(pkgQ.pkg.name, 'sp1dir1');
chai.equal(pkgQ.pkg.path, '/tmp/searchPath1/sp1dir1');
chai.equal(pkgQ.data.getIn(['pkg', 'version']), '1.0.0');
chai.equal(pkgQ.data.getIn(['pkg', 'name']), 'sp1dir1');
chai.equal(pkgQ.data.getIn(['pkg', 'path']), '/tmp/searchPath1/sp1dir1');
});

it('returns data for a matching substring with exact=fasle', function () {
const pkgQ = utils.getPkgInfo('sp1', this.store, false);
chai.equal(pkgQ.pkg.name, 'sp1dir1');
chai.equal(pkgQ.data.getIn(['pkg', 'name']), 'sp1dir1');
});

it('returns an error if pkg can\'t be found', function () {
Expand Down Expand Up @@ -124,15 +124,15 @@ describe('checkActivationState()', () => {
});

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

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

after(function () {
Expand All @@ -152,8 +152,8 @@ describe('findExternalSubgens()', () => {
});

it('finds packages that qualify as external subgens', function () {
const res = utils.findExternalSubgens(this.prefixes, 'sp1dir', this.store).results;
chai.ok(res.length, 2);
const resQ = utils.findExternalSubgens(this.prefixes, 'sp1dir', this.store);
chai.equal(resQ.data.get('results').size, 2);
});

after(function () {
Expand Down

0 comments on commit 4871fce

Please sign in to comment.