Skip to content

Instantly share code, notes, and snippets.

@sadick254
Last active June 20, 2018 16:59
Show Gist options
  • Save sadick254/86dd9afa540213a74eb6badfbebd7a48 to your computer and use it in GitHub Desktop.
Save sadick254/86dd9afa540213a74eb6badfbebd7a48 to your computer and use it in GitHub Desktop.
const assert = require("assert");
// .. code
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);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment