Skip to content

Commit

Permalink
Consolidate console label conversion tests + add timeLog
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino authored Jun 18, 2018
2 parents d42d45d + 6b14ce2 commit 38ef0a3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 101 deletions.
55 changes: 0 additions & 55 deletions console/console-counting-label-conversion.any.js

This file was deleted.

29 changes: 29 additions & 0 deletions console/console-label-conversion.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use strict";
// https://console.spec.whatwg/org/#counting
// https://console.spec.whatwg/org/#timing

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

for (const method of methods) {
test(() => {
let labelToStringCalled = false;

console[method]({
toString() {
labelToStringCalled = true;
}
});

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'}, () => {
console[method]({
toString() {
throw new Error('conversion error');
}
});
}, `${method} must re-throw any exceptions thrown by label.toString() conversion`);
}, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`);
}
46 changes: 0 additions & 46 deletions console/console-time-label-conversion.any.js

This file was deleted.

0 comments on commit 38ef0a3

Please sign in to comment.