Skip to content

Commit

Permalink
Inline factored out strings
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino committed Jun 18, 2018
1 parent 70c9654 commit 6b14ce2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions console/console-label-conversion.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
// https://console.spec.whatwg/org/#counting
// https://console.spec.whatwg/org/#timing

// toString() console label test strings
const toStringAssertionEnding = 'must call toString() on label when label is an object';
const toStringTestNameEnding = 'label gets converted to string via label.toString() when label is an object';

// toString error re-throwing console test strings
const toStringRethrowAssertionEnding = 'must re-throw any exceptions thrown by label.toString() conversion';
const toStringRethrowTestNameEnding = 'throws exceptions generated by erroneous label.toString() conversion';

const methods = ['count', 'countReset', 'time', 'timeLog', 'timeEnd'];

for (const method of methods) {
Expand All @@ -22,8 +14,8 @@ for (const method of methods) {
}
});

assert_true(labelToStringCalled, `${method}() ${toStringAssertionEnding}`);
}, `console.${method}()'s ${toStringTestNameEnding}`);
assert_true(labelToStringCalled, `${method}() must call toString() on label when label is an object`);
}, `console.${method}()'s label gets converted to string via label.toString() when label is an object`);

test(() => {
assert_throws({name: 'Error'}, () => {
Expand All @@ -32,6 +24,6 @@ for (const method of methods) {
throw new Error('conversion error');
}
});
}, `${method} ${toStringRethrowAssertionEnding}`);
}, `console.${method}() ${toStringRethrowTestNameEnding}`);
}, `${method} must re-throw any exceptions thrown by label.toString() conversion`);
}, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`);
}

0 comments on commit 6b14ce2

Please sign in to comment.