Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const assert = require("assert");
- function describe(testcase, callback) {
- console.log(testcase);
- callback();
- }
- function it(description, callback) {
- try {
- callback();
- console.log(`\t ✓ ${description}`);
- } catch (e) {
- console.log(`\t x ${description}`);
- }
- }
- function expect(actual) {
- return {
- toEqual(expected) {
- assert.equal(actual, expected);
- },
- toBe(expected) {
- assert.deepStrictEqual(actual, expected);
- },
- toBeTruthy() {
- assert.ok(actual);
- },
- toHaveLength(expected) {
- assert.ok(actual.length === expected);
- }
- };
- }
- module.exports = {
- describe,
- expect,
- it
- };
Add Comment
Please, Sign In to add comment