testit/test/index.spec.js

37 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2020-09-20 19:58:00 +00:00
import test from "../src/testit.js";
2020-09-08 22:37:24 +00:00
2020-09-20 19:58:00 +00:00
export default test.it({
"'like' should do truthy evaluation via ==": function () {
2022-07-31 05:40:35 +00:00
test.assert(1 == "1");
2020-09-20 19:58:00 +00:00
test.assert(1);
},
"'equal' should do === evaluation exist": function () {
test.assert(1 === 1);
2022-07-31 05:40:35 +00:00
test.assert("hello" === "hello");
2020-09-20 19:58:00 +00:00
},
"you should be able to 'pass' a test": function () {
test.assert(1);
},
"you should be able to fail' a test too": function () {
try {
test.assert(0);
} catch (e) {
2022-07-31 05:40:35 +00:00
// correct
}
2020-09-20 19:58:00 +00:00
},
"you should be able to test if something 'exists'": function () {
test.assert({});
2022-07-31 05:40:35 +00:00
test.assert(typeof ({}) === "object");
2020-09-20 19:58:00 +00:00
},
"should be able to check types": function () {
test.assert(Array.isArray([]));
2022-07-31 05:40:35 +00:00
test.assert(typeof (123) === "number");
2020-09-20 19:58:00 +00:00
2022-07-31 05:40:35 +00:00
test.assert(typeof ({}) === "object");
test.assert(typeof (true) === "boolean");
test.assert(typeof (false) === "boolean");
test.assert(typeof (undefined) === "undefined");
2020-09-20 19:58:00 +00:00
}
});