Commit 3c37e061 authored by Daniel Shumway's avatar Daniel Shumway

test: update tests to match `then`

- more tests need to be added, especially on tape's side
parent c4194e4a
Pipeline #8434327 passed with stage
in 1 minute and 2 seconds
......@@ -56,9 +56,9 @@ suite.test('Multiple tests', function () {
}
});
tests.push(_suite);
tests.push(_suite.test('A'));
tests.push(_suite.test('B'));
tests.push(_suite);
function assertion () {
this.test('Correct test/suite passed into each callback', function () {
......@@ -86,10 +86,10 @@ suite.test('Nested tests', function () {
B = A.test('B'),
C = B.test('C');
tests.push(_suite);
tests.push(A);
tests.push(B);
tests.push(C);
tests.push(B);
tests.push(A);
tests.push(_suite);
function assertion () {
this.test('Correct test/suite passed into each callback', function () {
......@@ -145,7 +145,7 @@ suite.test('Test statuses are set correctly', function () {
});
});
suite.test('Skip children of failed tests', function () {
suite.test('Include skipped tests', function () {
var def = deferred(),
calls = [];
......@@ -161,7 +161,7 @@ suite.test('Skip children of failed tests', function () {
_b = _suite.test('B').test('b').test('_b');
function assertion () {
assert.ok(calls.indexOf(_a) === -1, '`_a` should not be called');
assert.strictEqual(calls.length, 7, 'reporter fires for all tests');
}
return def.promise;
......
......@@ -47,14 +47,15 @@ suite.test('`then` exposes the suite:', function () {
return def.promise;
});
suite.test('`then` is called when a test finishes.', function (test) {
suite.test('`then` is called when a test finishes.', function () {
var that = this;
var def = deferred();
var _suite = new Distilled(function () {});
_suite.then(function () {
def.resolve();
this.test('`then` can be called multiple times on the same test.', function () {
that.test('`then` can be called multiple times on the same test.', function () {
var def = deferred();
_suite.then(function () {
......
......@@ -39,9 +39,9 @@ tape('Multiple tests', function (t) {
}
});
tests.push(suite);
tests.push(suite.test('A'));
tests.push(suite.test('B'));
tests.push(suite);
});
tape('Nested tests', function (t) {
......@@ -63,10 +63,10 @@ tape('Nested tests', function (t) {
var B = A.test('B');
var C = B.test('C');
tests.push(suite);
tests.push(A);
tests.push(B);
tests.push(C);
tests.push(B);
tests.push(A);
tests.push(suite);
});
tape('test statuses are set correctly for passed test', function (t) {
......@@ -101,19 +101,15 @@ tape('test statuses are set correctly for failed test', function (t) {
fail = suite.test('A', Promise.reject(error));
});
tape('Skip children of failed tests', function (t) {
tape('Skipped children are still called', function (t) {
t.plan(1);
var calls = 0;
var suite = new Distilled(function () {
++calls;
if (this.label === '_a') {
t.fail('label: ' + this.status);
}
if (this.label === '_b') {
t.equal(calls, 5, 'callbacks are not called for skipped tests');
if (this === suite) {
t.equal(calls, 7, 'callbacks are not called for skipped tests');
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment