Guest User

symetric

a guest
Sep 9th, 2020
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('Tests for isSymmetric(arr)', () => {
  2.     describe('Regular cases', () => {
  3.         // odd count - numbers only
  4.         it('should return true on isSymmetric([1,2,1])', () => {
  5.             expect(isSymmetric([1, 2, 1])).to.be.true;
  6.         });
  7.  
  8.         // even count - numbers only
  9.         it('should return false on isSymmetric([1,2,-1])', () => {
  10.             expect(isSymmetric([1, 2, -1])).to.be.false;
  11.         });
  12.  
  13.         // odd count - numbers only
  14.         it('should return true on isSymmetric([10,20,20,10])', () => {
  15.             expect(isSymmetric([10, 20, 20, 10])).to.be.true;
  16.         });
  17.  
  18.         // even count - numbers only
  19.         it('should return false on isSymmetric([10,20,30,10])', () => {
  20.             expect(isSymmetric([10, 20, 30, 10])).to.be.false;
  21.         });
  22.  
  23.         // odd count - mixed types
  24.         it('should return true on isSymmetric(["pesho",new Date(2016,8,15),false,new Date(2016,8,15), "pesho"])', () => {
  25.             expect(isSymmetric(["pesho", new Date(2016, 8, 15), false, new Date(2016, 8, 15), "pesho"])).to.be.true;
  26.         });
  27.  
  28.         // even count - mixed types
  29.         it('should return false on isSymmetric(["pesho",new Date(2016,8,15),false,new Date(2016,8,15), "pesho"])', () => {
  30.             expect(isSymmetric(["pesho", new Date(2016, 8, 15), false, "pesho"])).to.be.false;
  31.         });
  32.     });
  33.  
  34.     describe('Tests for isSymmetric(arr) - Edge cases', () => {
  35.         // number and string representation of the same number
  36.         it('should return false on isSymmetric(["2",2])', () => {
  37.             expect(isSymmetric(["2", 2])).to.be.false;
  38.         });
  39.  
  40.         // 1 item
  41.         it('should return true on isSymmetric([2])', () => {
  42.             expect(isSymmetric([2])).to.be.true;
  43.         });
  44.  
  45.         // []
  46.         it('should return true on isSymmetric([])', () => {
  47.             expect(isSymmetric([])).to.be.true;
  48.         });
  49.  
  50.         // string instead []
  51.         it('should return false on isSymmetric("hello")', () => {
  52.             expect(isSymmetric("hello")).to.be.false;
  53.         });
  54.  
  55.         // [[], [], []]
  56.         it('should return true on isSymmetric([[1,2], [2], [1,2]])', () => {
  57.             expect(isSymmetric([[1,2], [2], [1,2]])).to.be.true;
  58.         });
  59.     });
  60. });
RAW Paste Data