Advertisement
ErolKZ

Untitled

Feb 10th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1.  
  2.  
  3. describe('Add and subtract', () => {
  4.  
  5. it('Should contain add, subtract, get', () => {
  6.  
  7. let returnValue = createCalculator();
  8.  
  9. expect(returnValue).to.haveOwnProperty('add');
  10.  
  11. expect(returnValue).to.haveOwnProperty('subtract');
  12.  
  13. expect(returnValue).to.haveOwnProperty('get');
  14.  
  15. });
  16.  
  17.  
  18. it('Should not take any parameters', () => {
  19.  
  20. let obj = createCalculator();
  21.  
  22. obj.add(5);
  23.  
  24. obj.subtract(3);
  25.  
  26. let returnValue = obj.get();
  27.  
  28. expect(returnValue).to.equal(2);
  29.  
  30. });
  31.  
  32.  
  33. it('Should be a number', () => {
  34.  
  35. let obj = createCalculator();
  36.  
  37. obj.add('sss');
  38.  
  39. obj.subtract('dssa');
  40.  
  41. let returnValue = obj.get();
  42.  
  43. expect(returnValue).to.be.NaN;
  44.  
  45. });
  46.  
  47.  
  48. it('Should parse this - "12"', () => {
  49.  
  50. let obj = createCalculator();
  51.  
  52. obj.add('8');
  53.  
  54. obj.subtract('5');
  55.  
  56. let returnValue = obj.get();
  57.  
  58. expect(returnValue).to.equal(3);
  59.  
  60. });
  61.  
  62.  
  63. it('Should work with different input', () => {
  64.  
  65. let obj = createCalculator();
  66.  
  67. obj.add(8);
  68.  
  69. obj.subtract('5');
  70.  
  71. let returnValue = obj.get();
  72.  
  73. expect(returnValue).to.equal(3);
  74.  
  75. });
  76.  
  77.  
  78.  
  79. });
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement