all files / test/ test_mocha.js

100% Statements 18/18
100% Branches 0/0
100% Functions 0/0
100% Lines 18/18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                        
const {add ,mul,cover } = require('./math');
const {should,expect,assert} = require('chai');
 
describe('#math',() => {
    describe('add',() => {
        it('should return 5 when 2+3',() => {
           expect(add(2,3),5)
        });
        it('should return -1 when 2+ (-3)',() => {
            expect(add(2,-3),-1)
        })
    });
    describe('mul',() => {
        it('should return 5 when 2 * 3',() => {
            expect(mul(2,3),6)
        })
    });
 
    describe('cover',() => {
        it('should return 1 when cover(2,1)',() => {
            expect(cover(2,1)).to.equal(1);
        });
        it('should return 3 when cover(1,2)',() => {
            expect(cover(1,2)).to.equal(3);
        });
        it('should return 2 when cover(1,1)',() => {
            expect(cover(1,1)).to.equal(2);
        })
    })
});