Calculator.js
The dead simple Calculator.js is for the workshop
Usage
Install the package
npm install simplecalculatorjs
Simple package usage
const SimpleCalculatorJs = require('simplecalculatorjs');
var Calculator = SimpleCalculatorJs.Calculator;
var SimpleMath = SimpleCalculatorJs.SimpleMath;
var calculator = new Calculator(1, 2);
var simpleMath = new SimpleMath(2, 3);
console.log(calculator.add());
console.log(calculator.minus());
console.log(calculator.divide());
console.log(calculator.mul());
console.log(simpleMath.pow());
console.log(simpleMath.sqrt());
console.log(simpleMath.log());
console.log(simpleMath.logTen());
Testing
- clone the repo
git clone https://github.com/peter279k/calculator.js
- install the dev dependencies
npm install
- run testing
npm test
Slide sections
- Introduction Testing
- Assertions
- Node.js Unit Testing
- Code coverage
- istanbul
- CI service integration
- Code coverage service integration