Skip to content

Commit

Permalink
Improve mutation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurits Rijk committed Jun 23, 2017
1 parent 67c2a7a commit 40da506
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"gitbook-cli": "^2.3.0",
"istanbul": "^0.4.5",
"mocha": "^3.4.2",
"sinon": "^2.3.5",
"stryker": "^0.6.6",
"stryker-api": "^0.5.5",
"stryker-html-reporter": "^0.4.6",
Expand Down
5 changes: 2 additions & 3 deletions stryker.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module.exports = function(config) {
files: [
{ pattern: 'lib/*.js', mutated: true, included: false},
{ pattern: 'specs/*.js', mutated: false, included: false},
{ pattern: 'lib/util/*.js', mutated: false, included: false},
{ pattern: 'lib/util/*.js', mutated: true, included: false},
{ pattern: 'lib/test/*.js', mutated: false, included: false},
'test/*.js',
'test/utils.js'
'test/**/*.js'
],
testRunner: 'mocha',
testFramework: 'mocha',
Expand Down
1 change: 1 addition & 0 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {isString} = s.utils;
describe('Test the assert functions', () => {

it('should set and get the checkAsserts', () => {
expect(s.isCheckAsserts()).to.be.false; // default false
s.checkAsserts(true);
expect(s.isCheckAsserts()).to.be.true;
s.checkAsserts(false);
Expand Down
2 changes: 2 additions & 0 deletions test/exerciseFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ describe('Test the exerciseFn function', () => {
args: s.cat(':x', isInteger),
ret: isInteger
});

expect(s.exerciseFn(square, 7)).to.have.length(7);
});
});
8 changes: 8 additions & 0 deletions test/explain.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
const {expect} = require('chai');;
const sinon = require('sinon');

const s = require('../lib/spec');

const {isString} = s.utils;

describe('Test the explain function', () => {
it('should return the explanation string success', () => {
const stub = sinon.stub(process.stdout, 'write');
s.explain(isString, 'foobar');
stub.restore();
expect(stub.calledWith('Success!\n')).to.be.true;
});

it('should return the explanation string success', () => {
expect(s.explainStr(isString, 'foobar')).to.equal('Success!\n');
});
Expand Down
4 changes: 4 additions & 0 deletions test/isIntInRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ describe('Test isIntInRange? function', () => {
expect(s.isIntInRange(0, 13, -42)).to.be.false;
});

it('should have an upper bound that is larger than the lower bound', () => {
expect(s.isIntInRange(13, 0, 0)).to.be.false;
});

it('should use the spec to test', () => {
expect(check(s.isIntInRange, '../specs/intInRange')).to.have.property('result').to.equal(true);
});
Expand Down

0 comments on commit 40da506

Please sign in to comment.