formatting tweaks

This commit is contained in:
Geoff Doty 2019-01-13 17:09:21 -05:00
parent f38a7fe295
commit b5680387c4
1 changed files with 4 additions and 9 deletions

View File

@ -13,7 +13,7 @@
const test = { const test = {
"_tests": {}, "_tests": {},
"run": function run(errors, next) { "run": function run(errors, next) {
// rewrite to allow a show errors flag (optional) // TODO: rewrite to allow a show errors flag (optional)
if(typeof errors !== "boolean") { if(typeof errors !== "boolean") {
next = errors; next = errors;
errors = true; errors = true;
@ -62,9 +62,7 @@
return { return {
"to": { "to": {
"be": { "be": {
"a": (type) => { "a": (type) => { return test.expects(val).to.be.an(type); },
return test.expects(val).to.be.an(type);
},
"an": (type) => { "an": (type) => {
if(['array'].indexOf(type) !== -1) { if(['array'].indexOf(type) !== -1) {
@ -79,9 +77,7 @@
throw new Error(`expected ${typeof val} to be an ${type}`); throw new Error(`expected ${typeof val} to be an ${type}`);
} }
}, },
"ok": () => { "ok": () => { return test.expects(val).to.exist(); },
return test.expects(val).to.exist();
},
"like": (comp) => { "like": (comp) => {
if(val != comp) { if(val != comp) {
throw new Error(`expected ${val} == ${comp}`); throw new Error(`expected ${val} == ${comp}`);
@ -89,7 +85,6 @@
} }
}, },
"equal": (comp) => { "equal": (comp) => {
if(val !== comp) { if(val !== comp) {
throw new Error(`expected ${val} === ${comp}`); throw new Error(`expected ${val} === ${comp}`);
} }
@ -100,7 +95,7 @@
} }
}, },
"pass": () => { return true; }, "pass": () => { return true; },
"fail": (msg) => { throw new Error(msg); } "fail": (msg) => { throw new Error(msg); }
} }
}; };
} }