Last active
November 27, 2016 16:03
-
-
Save xphong/b055b554c68a7fabffca14b5cfa72572 to your computer and use it in GitHub Desktop.
Simple Mocha Unit Test
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
'use strict'; | |
const expect = require('chai').expect; | |
const CalculatorUtil = require('./CalculatorUtil'); | |
describe('Calculator Util', () => { | |
let calculatorUtil; | |
beforeEach(() => { | |
calculatorUtil = new CalculatorUtil(); | |
}); | |
it('should round to two decimals', () => { | |
expect(calculatorUtil.roundToTwoDecimals(64.999)).to.equal(65.00); | |
expect(calculatorUtil.roundToTwoDecimals(271.60123)).to.equal(271.60); | |
expect(calculatorUtil.roundToTwoDecimals(622.8475)).to.equal(622.85); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment