Created
May 6, 2020 15:15
-
-
Save gtkatakura/aeeabb08d37cef2be7316f9fbb5883ee to your computer and use it in GitHub Desktop.
This file contains 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
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