Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test cases for markOnly method
  • Loading branch information
arvidOtt committed Apr 23, 2020
commit b202e34028613885b2035f6ab9f727596bc8ebc3
37 changes: 37 additions & 0 deletions test/unit/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var mocha = require('../../lib/mocha');
var Test = mocha.Test;
var sinon = require('sinon');

describe('Test', function() {
describe('.clone()', function() {
Expand Down Expand Up @@ -83,4 +84,40 @@ describe('Test', function() {
expect(this._test.isPending(), 'to be', true);
});
});

describe('.markOnly()', function() {
var sandbox;

beforeEach(function() {
sandbox = sinon.createSandbox();
});

afterEach(function() {
sandbox.restore();
});

it('should call appendOnlyTest on parent', function() {
Comment thread
arvidOtt marked this conversation as resolved.
var test = new Test('foo');
var spy = sandbox.spy();
test.parent = {
appendOnlyTest: spy
};

test.markOnly();

expect(spy, 'was called times', 1);
});

it('should pass itself as an argument', function() {
var test = new Test('foo');
var spy = sandbox.spy();
test.parent = {
appendOnlyTest: spy
};

test.markOnly();

expect(spy.getCall(0).args[0], 'to be', test);
});
});
});