Skip to content

Commit

Permalink
Merge pull request #2704 from seppevs/increase_test_coverage_of_mocha_js
Browse files Browse the repository at this point in the history
increase test coverage of mocha.js
  • Loading branch information
Munter committed Jul 1, 2017
2 parents 1f270cd + 1b1377c commit 1df7c94
Showing 1 changed file with 135 additions and 0 deletions.
135 changes: 135 additions & 0 deletions test/unit/mocha.spec.js
Expand Up @@ -32,4 +32,139 @@ describe('Mocha', function () {
});
});
});

describe('.addFile()', function () {
it('should add the given file to the files array', function () {
var mocha = new Mocha(blankOpts);
mocha.addFile('myFile.js');
mocha.files.length.should.equal(1);
mocha.files[0].should.equal('myFile.js');
});
});

describe('.invert()', function () {
it('should set the invert option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.invert();
mocha.options.invert.should.equal(true);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.invert().should.equal(mocha);
});
});

describe('.ignoreLeaks()', function () {
it('should set the ignoreLeaks option to true when param equals true', function () {
var mocha = new Mocha(blankOpts);
mocha.ignoreLeaks(true);
mocha.options.ignoreLeaks.should.equal(true);
});

it('should set the ignoreLeaks option to false when param equals false', function () {
var mocha = new Mocha(blankOpts);
mocha.ignoreLeaks(false);
mocha.options.ignoreLeaks.should.equal(false);
});

it('should set the ignoreLeaks option to false when the param is undefined', function () {
var mocha = new Mocha(blankOpts);
mocha.ignoreLeaks();
mocha.options.ignoreLeaks.should.equal(false);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.ignoreLeaks(false).should.equal(mocha);
});
});

describe('.checkLeaks()', function () {
it('should set the ignoreLeaks option to false', function () {
var mocha = new Mocha(blankOpts);
mocha.checkLeaks();
mocha.options.ignoreLeaks.should.equal(false);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.checkLeaks().should.equal(mocha);
});
});

describe('.fullTrace()', function () {
it('should set the fullStackTrace option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.fullTrace();
mocha.options.fullStackTrace.should.equal(true);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.fullTrace().should.equal(mocha);
});
});

describe('.growl()', function () {
it('should set the growl option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.growl();
mocha.options.growl.should.equal(true);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.growl().should.equal(mocha);
});
});

describe('.useInlineDiffs()', function () {
it('should set the useInlineDiffs option to true when param equals true', function () {
var mocha = new Mocha(blankOpts);
mocha.useInlineDiffs(true);
mocha.options.useInlineDiffs.should.equal(true);
});

it('should set the useInlineDiffs option to false when param equals false', function () {
var mocha = new Mocha(blankOpts);
mocha.useInlineDiffs(false);
mocha.options.useInlineDiffs.should.equal(false);
});

it('should set the useInlineDiffs option to false when the param is undefined', function () {
var mocha = new Mocha(blankOpts);
mocha.useInlineDiffs();
mocha.options.useInlineDiffs.should.equal(false);
});

it('should be chainable', function () {
var mocha = new Mocha(blankOpts);
mocha.useInlineDiffs().should.equal(mocha);
});
});

describe('.noHighlighting()', function () {
it('should set the noHighlighting option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.noHighlighting();
mocha.options.noHighlighting.should.equal(true);
});
});

describe('.allowUncaught()', function () {
it('should set the allowUncaught option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.allowUncaught();
mocha.options.allowUncaught.should.equal(true);
});
});

describe('.delay()', function () {
it('should set the delay option to true', function () {
var mocha = new Mocha(blankOpts);
mocha.delay();
mocha.options.delay.should.equal(true);
});
});
});

0 comments on commit 1df7c94

Please sign in to comment.