Created
November 13, 2019 04:17
-
-
Save togakangaroo/f7c0c83d5d70ef094be84cd995b22c2e 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
describe(`Stopwatch`, () => { | |
let clock | |
beforeEach(() => clock = useFakeTimers()) | |
afterEach(() => clock.restore()) | |
describe(`new instance`, () => { | |
let sw | |
beforeEach(() => sw = createStopWatch()) | |
it(`shows nothing on main display`, () => expect(sw.displays.main).to.equal(null)) | |
it(`shows no laps`, () => expect(sw.displays.laps).to.deep.equal([])) | |
describe(`1s elapses`, () => { | |
beforeEach(() => clock.tick(1000)) | |
it(`shows nothing on main display`, () => expect(sw.displays.main).to.equal(null)) | |
it(`shows no laps`, () => expect(sw.displays.laps).to.deep.equal([])) | |
}) | |
describe(`started`, () => { | |
beforeEach(() => sw.toggle()) | |
it(`shows 0s on main display`, () => expect(sw.displays.main).to.equal(0)) | |
it(`shows no laps`, () => expect(sw.displays.laps).to.deep.equal([])) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment