Skip to content

Instantly share code, notes, and snippets.

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 gtkatakura/aeeabb08d37cef2be7316f9fbb5883ee to your computer and use it in GitHub Desktop.
Save gtkatakura/aeeabb08d37cef2be7316f9fbb5883ee to your computer and use it in GitHub Desktop.
let level = 1
const execute = (callback) => {
level++;
callback()
level--;
}
const print = text => {
console.log(' '.repeat(level) + text)
}
function describe(description, callback) {
print(description);
execute(callback);
}
function it(description, callback) {
print(description);
execute(callback);
}
function expect(left) {
return {
toBe(right) {
if (left !== right) {
print(`expected "${left}" to be "${right}"`);
}
},
};
}
describe("booleans", () => {
describe('when left is false', () => {
it("false === false", () => {
expect(false).toBe(true);
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment