Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('mathEnforcer', ()=> {
- describe('addFive', () => {
- it('test with incorrect input', () => {
- expect(mathEnforcer.addFive('123')).to.equal(undefined)
- });
- it('test with incorrect input 1', () => {
- expect(mathEnforcer.addFive(true)).to.equal(undefined)
- });
- it('test with correct input int', () => {
- expect(mathEnforcer.addFive(5)).to.equal(10)
- });
- it('test with correct input int', () => {
- expect(mathEnforcer.addFive(-5)).to.equal(0)
- });
- it('test with floating nums', () => {
- expect(mathEnforcer.addFive(5.5)).closeTo(10.5, 0.01);
- })
- });
- describe('subtractTen', () => {
- it('test with incorrect input', () => {
- expect(mathEnforcer.subtractTen('123')).to.equal(undefined)
- });
- it('test with correct input int', () => {
- expect(mathEnforcer.subtractTen(5)).to.equal(-5)
- });
- it('test with correct input int negative', () => {
- expect(mathEnforcer.subtractTen(-5)).to.equal(-15)
- });
- it('test with correct input float nums', () => {
- expect(mathEnforcer.subtractTen(-5.5)).closeTo(-15.5,0.01)
- });
- });
- describe('sum', ()=> {
- it('test with incorrect input', () => {
- expect(mathEnforcer.sum('123', '123')).to.equal(undefined)
- });
- it('test with incorrect input 1', () => {
- expect(mathEnforcer.sum('123', 1)).to.equal(undefined)
- });
- it('test with incorrect input 2', () => {
- expect(mathEnforcer.sum(2, '1')).to.equal(undefined)
- });
- it('test with correct input with int', () => {
- expect(mathEnforcer.sum(2, 1)).to.equal(3);
- });
- it('test with correct input with float nums', () => {
- expect(mathEnforcer.sum(2.5, 1.2)).closeTo(3.7, 0.01);
- });
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment