Created
February 9, 2017 17:09
-
-
Save giltayar/55ff3aae3b5629614a6d9d121f22e96b to your computer and use it in GitHub Desktop.
Parts of the calculator module unit test
This file contains hidden or 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
const {describe, it} = require('mocha') | |
const {expect} = require('chai') | |
const calculator = require('../../lib/calculator') | |
describe('calculator', function () { | |
const stream = (characters, calculatorState = calculator.initialState) => | |
!characters | |
? calculatorState | |
: stream(characters.slice(1), | |
calculator.nextState(calculatorState, characters[0])) | |
it('should show initial display correctly', () => { | |
expect(calculator.initialState.display).to.equal('0') | |
}) | |
it('should replace 0 in initialState', () => { | |
expect(stream('4').display).to.equal('4') | |
}) | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment