Advertisement
vvsvvs

Untitled

Oct 5th, 2022
912
0
122 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("Test Symetry function", () => {
  2.     it("Return false for numeric input", () => {
  3.         let num = 4.3;        
  4.  
  5.         let expected = false;
  6.  
  7.         let actual = isSymmetric(num);
  8.         expect(actual).to.equal(expected);
  9.     });
  10.  
  11.     it("Return false for string input", () => {
  12.         let str = "ADF";
  13.  
  14.         let expected = false;
  15.        
  16.         actual = isSymmetric(str);
  17.         expect(actual).to.equal(expected);
  18.     });
  19.  
  20.     it("Return false for object input", () => {
  21.         let obj = {a: 4, b: 'AAA'};
  22.  
  23.         let expected = false;
  24.        
  25.         actual = isSymmetric(obj);
  26.         expect(actual).to.equal(expected);
  27.     });
  28.  
  29.     it("Return false for bool input", () => {
  30.         let bool = true;
  31.        
  32.         let expected = false;        
  33.  
  34.         actual = isSymmetric(bool);
  35.         expect(actual).to.equal(expected);
  36.     });
  37.  
  38.     it("Return false for function input", () => {
  39.         let func = (a) => a ** a;
  40.        
  41.         let expected = false;        
  42.  
  43.         actual = isSymmetric(func);
  44.         expect(actual).to.equal(expected);
  45.     });
  46.  
  47.     it("Return false for undefine input", () => {
  48.         let und;
  49.        
  50.         let expected = false;        
  51.  
  52.         actual = isSymmetric(und);
  53.         expect(actual).to.equal(expected);
  54.     });
  55.  
  56.     it("Return true for symetric input array with even elements", () => {
  57.         let arr = [1, 2, 3, 3, 2, 1];
  58.        
  59.         let expected = true;        
  60.  
  61.         actual = isSymmetric(arr);
  62.         expect(actual).to.equal(expected);
  63.     });
  64.  
  65.     it("Return true for symetric input array with odd elements", () => {
  66.         let arr = [[1, 2, 3], 2, 3, 1, 3, 2, [1, 2, 3]];
  67.        
  68.         let expected = true;        
  69.  
  70.         actual = isSymmetric(arr);
  71.         expect(actual).to.equal(expected);
  72.     });
  73.  
  74.     it("Return true for symetric input with empty array", () => {
  75.         let arr = [];
  76.        
  77.         let expected = true;        
  78.  
  79.         actual = isSymmetric(arr);
  80.         expect(actual).to.equal(expected);
  81.     });
  82.    
  83.     it("Return true for asymetric input array with even elements", () => {
  84.         let arr = [1, 2, 3, '3', 2, 1];
  85.        
  86.         let expected = false;        
  87.  
  88.         actual = isSymmetric(arr);
  89.         expect(actual).to.equal(expected);
  90.     });
  91.  
  92.     it("Return true for asymetric input array with odd elements", () => {
  93.         let arr = [[1, 2, 3], 1, 3, 1, 3, 2, [1, 2, 3]];
  94.        
  95.         let expected = false;        
  96.  
  97.         actual = isSymmetric(arr);
  98.         expect(actual).to.equal(expected);
  99.     });
  100. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement