Advertisement
ilianrusev

Untitled

Feb 15th, 2022
26
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("Tests …", () => {
  2. describe("sumNumbers method", () => {
  3. it("not numbers", () => {
  4. expect(testNumbers.sumNumbers("", 2)).to.be.undefined
  5. })
  6. it("not numbers", () => {
  7. expect(testNumbers.sumNumbers(1, "")).to.be.undefined
  8. })
  9. it("not numbers", () => {
  10. expect(testNumbers.sumNumbers("", "")).to.be.undefined
  11. })
  12. it("correct input", () => {
  13. expect(testNumbers.sumNumbers(1, 2)).to.be.equal("3.00")
  14. })
  15. it("correct input", () => {
  16. expect(testNumbers.sumNumbers(0, 0)).to.be.equal("0.00")
  17. })
  18. it("correct input", () => {
  19. expect(testNumbers.sumNumbers(1, 2.5)).to.be.equal("3.50")
  20. })
  21. it("correct input", () => {
  22. expect(testNumbers.sumNumbers(1.5, 2)).to.be.equal("3.50")
  23. })
  24. it("correct input", () => {
  25. expect(testNumbers.sumNumbers(2, -1)).to.be.equal("1.00")
  26. })
  27. it("correct input", () => {
  28. expect(testNumbers.sumNumbers(-2, -1)).to.be.equal("-3.00")
  29. })
  30. it("correct input", () => {
  31. expect(testNumbers.sumNumbers(-2.5, 1)).to.be.equal("-1.50")
  32. })
  33. })
  34.  
  35. describe("numberChecker method", () => {
  36. it("not number", () => {
  37. expect(() => {
  38. testNumbers.numberChecker("").to.throw("The input is not a number!")
  39. })
  40. })
  41. it("not number", () => {
  42. expect(() => {
  43. testNumbers.numberChecker([]).to.throw("The input is not a number!")
  44. })
  45. })
  46. it("even",() => {
  47. expect(testNumbers.numberChecker(2)).to.be.equal("The number is even!")
  48. })
  49. it("even",() => {
  50. expect(testNumbers.numberChecker(0)).to.be.equal("The number is even!")
  51. })
  52. it("odd",() => {
  53. expect(testNumbers.numberChecker(1)).to.be.equal("The number is odd!")
  54. })
  55. })
  56.  
  57. describe("averageSumArray method", () => {
  58. it("correct return",()=>{
  59. expect(testNumbers.averageSumArray([5,2,3,0])).to.be.equal(2.5)
  60. })
  61. it("correct return",()=>{
  62. expect(testNumbers.averageSumArray([5,5])).to.be.equal(5)
  63. })
  64.  
  65. })
  66. });
  67.  
Advertisement
RAW Paste Data Copied
Advertisement