Skip to content

Instantly share code, notes, and snippets.

@mantaskaveckas
Created March 4, 2020 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mantaskaveckas/b3cba5ce66eb785cce65399aaa811e0f to your computer and use it in GitHub Desktop.
Save mantaskaveckas/b3cba5ce66eb785cce65399aaa811e0f to your computer and use it in GitHub Desktop.
const describe = (description, callback) => {
console.log(description);
callback();
};
const it = (message, callback) => describe(` ${message}`, callback);
const matchers = expression => ({
toBe: assertion => {
if (expression === assertion) {
console.log("PASS");
return true;
} else {
console.log("FAIL");
return false;
}
}
});
const expect = expression => matchers(expression);
function multiplier(a, b) {
return a * b;
}
describe("multiplier", () => {
it("multiplies two numbers", () => {
const result = multiplier(5, 2);
expect(result).toBe(10);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment