SHARE
TWEET

Untitled

a guest Nov 2nd, 2018 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("mathEnforcer functionality", function () {
  2.     describe("addFive", function (){
  3.         it("should accept only a number as a parameter", function () {
  4.             expect(mathEnforcer.addFive("pesho")).to.equal(undefined, "The function accepts only numbers!");
  5.         });
  6.  
  7.         it("should accept only a number as a parameter", function () {
  8.             expect(mathEnforcer.addFive(null)).to.equal(undefined, "The function accepts only numbers!");
  9.         });
  10.  
  11.         it("should accept only a number as a parameter", function () {
  12.             expect(mathEnforcer.addFive({})).to.equal(undefined, "The function accepts only numbers!");
  13.         });
  14.  
  15.         it("should accept only a number as a parameter", function () {
  16.             expect(mathEnforcer.addFive()).to.equal(undefined, "The function accepts only numbers!");
  17.         });
  18.  
  19.         it("should accept a number as a parameter", function () {
  20.             expect(mathEnforcer.addFive(1)).to.equal(6, "The function returns incorrect result!");
  21.         });
  22.  
  23.         it("should accept a number as a parameter", function () {
  24.             expect(mathEnforcer.addFive(0)).to.equal(5, "The function returns incorrect result!");
  25.         });
  26.  
  27.         it("should accept a number as a parameter", function () {
  28.             expect(mathEnforcer.addFive(-2)).to.equal(3, "The function returns incorrect result!");
  29.         });
  30.  
  31.         it("should work with floating numbers", function () {
  32.             expect(mathEnforcer.addFive(3.12)).to.be.closeTo(8.12, 0.01, "The function should work with floating numbers!");
  33.         });
  34.  
  35.         it("should work with floating numbers", function () {
  36.             expect(mathEnforcer.addFive(-2.12)).to.be.closeTo(2.88, 0.01, "The function should work with floating numbers!");
  37.         });
  38.     });
  39.  
  40.     describe("substractTen", function () {
  41.         it("should accept only a number as a parameter", function () {
  42.             expect(mathEnforcer.subtractTen("pesho")).to.equal(undefined, "The function accepts only numbers!");
  43.         });
  44.  
  45.         it("should accept only a number as a parameter", function () {
  46.             expect(mathEnforcer.subtractTen({})).to.equal(undefined, "The function accepts only numbers!");
  47.         });
  48.  
  49.         it("should accept only a number as a parameter", function () {
  50.             expect(mathEnforcer.subtractTen()).to.equal(undefined, "The function accepts only numbers!");
  51.         });
  52.  
  53.         it("should accept only a number as a parameter", function () {
  54.             expect(mathEnforcer.subtractTen(null)).to.equal(undefined, "The function accepts only numbers!");
  55.         });
  56.  
  57.         it("should accept a number as a parameter", function () {
  58.             expect(mathEnforcer.subtractTen(11)).to.equal(1, "The function returns incorrect result!");
  59.         });
  60.  
  61.         it("should accept a number as a parameter", function () {
  62.             expect(mathEnforcer.subtractTen(-2)).to.equal(-12, "The function returns incorrect result!");
  63.         });
  64.  
  65.         it("should accept a number as a parameter", function () {
  66.             expect(mathEnforcer.subtractTen(0)).to.equal(-10, "The function returns incorrect result!");
  67.         });
  68.  
  69.         it("should accept a number as a parameter", function () {
  70.             expect(mathEnforcer.subtractTen(-2.5)).to.equal(-12.5, "The function returns incorrect result!");
  71.         });
  72.  
  73.         it("should work with floating numbers", function () {
  74.             expect(mathEnforcer.subtractTen(3.12)).to.be.closeTo(-6.88, 0.01, "The function should work with floating numbers!");
  75.         });
  76.     });
  77.  
  78.     describe("sum", function () {
  79.         it("should accept a number as first parameter", function () {
  80.             expect(mathEnforcer.sum("pesho", 3)).to.equal(undefined, "The function accepts only a number as first parameter!");
  81.         });
  82.  
  83.         it("should accept a number as second parameter", function () {
  84.             expect(mathEnforcer.sum(3, "pesho")).to.equal(undefined, "The function accepts only a number as second parameter!");
  85.         });
  86.  
  87.         it("should accept a numbers as parameter", function () {
  88.             expect(mathEnforcer.sum("gosho", "pesho")).to.equal(undefined, "The function accepts only a numbers as parameter!");
  89.         });
  90.  
  91.         it("should accept a number as first parameter", function () {
  92.             expect(mathEnforcer.sum(null, 3)).to.equal(undefined, "The function accepts only a number as first parameter!");
  93.         });
  94.  
  95.         it("should accept a number as second parameter", function () {
  96.             expect(mathEnforcer.sum(3, null)).to.equal(undefined, "The function accepts only a number as second parameter!");
  97.         });
  98.  
  99.         it("should accept a number as parameters", function () {
  100.             expect(mathEnforcer.sum("pesho")).to.equal(undefined, "The function accepts only a number as parameters!");
  101.         });
  102.  
  103.         it("should accept a number as parameters", function () {
  104.             expect(mathEnforcer.sum([1, 2])).to.equal(undefined, "The function accepts only a number as parameters!");
  105.         });
  106.  
  107.         it("should accept a number as parameters", function () {
  108.             expect(mathEnforcer.sum([1], [2])).to.equal(undefined, "The function accepts only a number as parameters!");
  109.         });
  110.  
  111.         it("should accept a number as parameters", function () {
  112.             expect(mathEnforcer.sum({}, {})).to.equal(undefined, "The function accepts only a number as parameters!");
  113.         });
  114.  
  115.         it("should receive 2 parameters", function () {
  116.             expect(mathEnforcer.sum(3)).to.equal(undefined, "The function requires 2 parameters!");
  117.         });
  118.  
  119.         it("should receive 2 parameters", function () {
  120.             expect(mathEnforcer.sum()).to.equal(undefined, "The function requires 2 parameters!");
  121.         });
  122.  
  123.         it("should work with negative numbers", function () {
  124.             expect(mathEnforcer.sum(-3, -7)).to.equal(-10, "The function should work with negative numbers!");
  125.         });
  126.  
  127.         it("should work", function () {
  128.             expect(mathEnforcer.sum(3, 7)).to.equal(10, "The function should work!");
  129.         });
  130.  
  131.         it("should work", function () {
  132.             expect(mathEnforcer.sum(0, 2)).to.equal(2, "The function should work!");
  133.         });
  134.  
  135.         it("should work", function () {
  136.             expect(mathEnforcer.sum(0, 0)).to.equal(0, "The function should work!");
  137.         });
  138.  
  139.         it("should work with negative numbers", function () {
  140.             expect(mathEnforcer.sum(-3, 5)).to.equal(2, "The function should work with negative numbers!");
  141.         });
  142.  
  143.         it("should work with floating numbers", function () {
  144.             expect(mathEnforcer.sum(1.004, 3.14)).to.be.closeTo(4.144, 0.01, "The function should work with floating numbers!");
  145.         });
  146.  
  147.         it("should work with floating numbers", function () {
  148.             expect(mathEnforcer.sum(-1.004, -3.14)).to.be.closeTo((-1.004 - -3.14), 0.01, "The function should work with floating numbers!");
  149.         });
  150.  
  151.         it("should work with floating numbers", function () {
  152.             expect(mathEnforcer.sum(-2.00014, 61.2)).to.be.closeTo(59.19986, 0.01, "The function should work with floating numbers!");
  153.         });
  154.  
  155.         it("should work with floating numbers", function () {
  156.             expect(mathEnforcer.sum(0.01, 0.02)).to.be.closeTo(0.03, 0.01, "The function should work with floating numbers!");
  157.         });
  158.     });
  159.  
  160. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top