eternalmeg

04

Jun 21st, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. describe('mathEnforcer', ()=> {
  2. describe('addFive', () => {
  3. it('test with incorrect input', () => {
  4. expect(mathEnforcer.addFive('123')).to.equal(undefined)
  5. });
  6. it('test with incorrect input 1', () => {
  7. expect(mathEnforcer.addFive(true)).to.equal(undefined)
  8. });
  9.  
  10. it('test with correct input int', () => {
  11. expect(mathEnforcer.addFive(5)).to.equal(10)
  12. });
  13. it('test with correct input int', () => {
  14. expect(mathEnforcer.addFive(-5)).to.equal(0)
  15. });
  16. it('test with floating nums', () => {
  17. expect(mathEnforcer.addFive(5.5)).closeTo(10.5, 0.01);
  18. })
  19. });
  20. describe('subtractTen', () => {
  21. it('test with incorrect input', () => {
  22. expect(mathEnforcer.subtractTen('123')).to.equal(undefined)
  23. });
  24. it('test with correct input int', () => {
  25. expect(mathEnforcer.subtractTen(5)).to.equal(-5)
  26. });
  27. it('test with correct input int negative', () => {
  28. expect(mathEnforcer.subtractTen(-5)).to.equal(-15)
  29. });
  30. it('test with correct input float nums', () => {
  31. expect(mathEnforcer.subtractTen(-5.5)).closeTo(-15.5,0.01)
  32. });
  33. });
  34. describe('sum', ()=> {
  35. it('test with incorrect input', () => {
  36. expect(mathEnforcer.sum('123', '123')).to.equal(undefined)
  37. });
  38. it('test with incorrect input 1', () => {
  39. expect(mathEnforcer.sum('123', 1)).to.equal(undefined)
  40. });
  41. it('test with incorrect input 2', () => {
  42. expect(mathEnforcer.sum(2, '1')).to.equal(undefined)
  43. });
  44. it('test with correct input with int', () => {
  45. expect(mathEnforcer.sum(2, 1)).to.equal(3);
  46. });
  47. it('test with correct input with float nums', () => {
  48. expect(mathEnforcer.sum(2.5, 1.2)).closeTo(3.7, 0.01);
  49. });
  50. })
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. })
Advertisement
Add Comment
Please, Sign In to add comment