Skip to content

Instantly share code, notes, and snippets.

@xphong
Last active November 27, 2016 16:03
Show Gist options
  • Save xphong/b055b554c68a7fabffca14b5cfa72572 to your computer and use it in GitHub Desktop.
Save xphong/b055b554c68a7fabffca14b5cfa72572 to your computer and use it in GitHub Desktop.
Simple Mocha Unit Test
'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