Skip to content

Commit

Permalink
add tests for createFlaggedDescribe
Browse files Browse the repository at this point in the history
  • Loading branch information
victormejiacs committed Feb 8, 2021
1 parent f2e1021 commit 9d737ef
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/mocha/test/acceptance/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe(function() {
it('works', async function() {
let stats = await this.runTests();

expect(stats.passes).to.equal(1);
expect(stats.passes).to.equal(4);
});
});

Expand Down
34 changes: 32 additions & 2 deletions packages/mocha/test/fixtures/flag-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

const assert = require('assert');
const { createFlaggedTest } = require('../../src');
const { createFlaggedTest, createFlaggedDescribe } = require('../../src');

const it = createFlaggedTest(global, ['flag1']);
const describe = createFlaggedDescribe(global, ['flag1']);

describe('flag', function() {
describe('flag - it', function() {
it({
name: 'test with a flag',
flags: ['flag1'],
Expand All @@ -27,3 +28,32 @@ describe('flag', function() {
assert.ok(true);
});
});

describe('flag - describe', function() {
describe({
name: 'test with a flag',
flags: ['flag1'],
}, function () {
it('works', function () {
assert.ok(true);
});
});

describe({
name: 'test with an inverted flag',
flags: ['!flag1'],
}, function () {
it('works', function () {
assert.ok(true);
});
});

describe({
name: 'test with a missing flag',
flags: ['flag2'],
}, function () {
it('works', function () {
assert.ok(true);
});
});
});

0 comments on commit 9d737ef

Please sign in to comment.