Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Oct 22, 2019
1 parent 9cd7111 commit 72f7bfc
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions test/unit/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,50 @@ describe('Mocha', function() {
expect(mocha.options, 'to have property', 'allowUncaught', true);
});

it('should set the allowUncaught option to false', function() {
var mocha = new Mocha(opts);
mocha.allowUncaught(false);
expect(mocha.options, 'to have property', 'allowUncaught', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.allowUncaught(), 'to be', mocha);
});
});

describe('#asyncOnly()', function() {
it('should set the asyncOnly option to true', function() {
var mocha = new Mocha(opts);
mocha.asyncOnly();
expect(mocha.options, 'to have property', 'asyncOnly', true);
});

it('should set the asyncOnly option to false', function() {
var mocha = new Mocha(opts);
mocha.asyncOnly(false);
expect(mocha.options, 'to have property', 'asyncOnly', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.asyncOnly(), 'to be', mocha);
});
});

describe('#bail()', function() {
it('should set the suite._bail to true if there is no arguments', function() {
var mocha = new Mocha(opts);
mocha.bail();
expect(mocha.suite._bail, 'to be', true);
});

it('should set the suite._bail to false', function() {
var mocha = new Mocha(opts);
mocha.bail(false);
expect(mocha.suite._bail, 'to be', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.bail(), 'to be', mocha);
Expand All @@ -84,12 +115,37 @@ describe('Mocha', function() {
expect(mocha.options, 'to have property', 'checkLeaks', true);
});

it('should set the checkLeaks option to false', function() {
var mocha = new Mocha(opts);
mocha.checkLeaks(false);
expect(mocha.options, 'to have property', 'checkLeaks', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.checkLeaks(), 'to be', mocha);
});
});

describe('#color()', function() {
it('should set the color option to true', function() {
var mocha = new Mocha(opts);
mocha.color();
expect(mocha.options, 'to have property', 'color', true);
});

it('should set the color option to false', function() {
var mocha = new Mocha(opts);
mocha.color(false);
expect(mocha.options, 'to have property', 'color', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.color(), 'to be', mocha);
});
});

describe('#delay()', function() {
it('should set the delay option to true', function() {
var mocha = new Mocha(opts);
Expand All @@ -116,13 +172,76 @@ describe('Mocha', function() {
});
});

describe('#diff()', function() {
it('should set the diff option to true', function() {
var mocha = new Mocha(opts);
mocha.diff();
expect(mocha.options, 'to have property', 'diff', true);
});

it('should set the diff option to false', function() {
var mocha = new Mocha(opts);
mocha.diff(false);
expect(mocha.options, 'to have property', 'diff', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.diff(), 'to be', mocha);
});
});

describe('#forbidOnly()', function() {
it('should set the forbidOnly option to true', function() {
var mocha = new Mocha(opts);
mocha.forbidOnly();
expect(mocha.options, 'to have property', 'forbidOnly', true);
});

it('should set the forbidOnly option to false', function() {
var mocha = new Mocha(opts);
mocha.forbidOnly(false);
expect(mocha.options, 'to have property', 'forbidOnly', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.forbidOnly(), 'to be', mocha);
});
});

describe('#forbidPending()', function() {
it('should set the forbidPending option to true', function() {
var mocha = new Mocha(opts);
mocha.forbidPending();
expect(mocha.options, 'to have property', 'forbidPending', true);
});

it('should set the forbidPending option to false', function() {
var mocha = new Mocha(opts);
mocha.forbidPending(false);
expect(mocha.options, 'to have property', 'forbidPending', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.forbidPending(), 'to be', mocha);
});
});

describe('#fullTrace()', function() {
it('should set the fullTrace option to true', function() {
var mocha = new Mocha(opts);
mocha.fullTrace();
expect(mocha.options, 'to have property', 'fullTrace', true);
});

it('should set the fullTrace option to false', function() {
var mocha = new Mocha(opts);
mocha.fullTrace(false);
expect(mocha.options, 'to have property', 'fullTrace', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.fullTrace(), 'to be', mocha);
Expand Down Expand Up @@ -263,6 +382,25 @@ describe('Mocha', function() {
});
});

describe('#inlineDiffs()', function() {
it('should set the inlineDiffs option to true', function() {
var mocha = new Mocha(opts);
mocha.inlineDiffs();
expect(mocha.options, 'to have property', 'inlineDiffs', true);
});

it('should set the inlineDiffs option to false', function() {
var mocha = new Mocha(opts);
mocha.inlineDiffs(false);
expect(mocha.options, 'to have property', 'inlineDiffs', false);
});

it('should be chainable', function() {
var mocha = new Mocha(opts);
expect(mocha.inlineDiffs(), 'to be', mocha);
});
});

describe('#invert()', function() {
it('should set the invert option to true', function() {
var mocha = new Mocha(opts);
Expand Down

0 comments on commit 72f7bfc

Please sign in to comment.