Created
June 20, 2018 17:24
-
-
Save sadick254/79ab060a64b099b20a37775746b90fe1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment