Advertisement
Lulunga

Unit Testing 03. Char lookup

Oct 21st, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("Lookup Char tests", function(){
  2.    it("should return undefined non string first parameter", function(){
  3.       expect(lookupChar(13, 0)).to.equal(undefined);
  4.     }),
  5.     it("should return undefined non string second parameter", function(){
  6.         expect(lookupChar("asdasddd", "asdasd")).to.equal(undefined);
  7.     }),
  8.    it("should return undefined with floating point number second parameter", function(){
  9.         expect(lookupChar("asdasd", 3.23)).to.equal(undefined);
  10.     })
  11.  
  12.   it("should return incorrect index with incorrect index value", function(){
  13.          expect(lookupChar("asdasd", 13)).to.equal("Incorrect index");
  14.      })
  15.     it("should return incorrect index with negative index value", function(){
  16.          expect(lookupChar("asdasd", -1)).to.equal("Incorrect index");
  17.     })
  18.     it("should return incorrect index with index value equal to string length", function(){
  19.       expect(lookupChar("asdasd", 6)).to.equal("Incorrect index");
  20.     })
  21.  
  22.     it("should return success", function(){
  23.          expect(lookupChar("asdasd", 0)).to.equal("a");
  24.     })
  25.      it("should return success", function(){
  26.         expect(lookupChar("asdasd", 5)).to.equal("d");
  27.      })
  28.  })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement