Guest User

Untitled

a guest
Jul 4th, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let expect = require('chai').expect;
  2. let charLookup = require('./char_lookup.js');
  3.  
  4. describe("charLookup", function () {
  5.     it(' should return undefined with a non-string as a first parameter', function () {
  6.         expect(charLookup(13, 0)).to.equal(undefined, "The function did not return correct result");
  7.     });
  8.     it('should return undefined with a non-number as a second parameter', function () {
  9.         expect(charLookup("test", "wrong")).to.equal(undefined, "The function did not return correct result");
  10.     });
  11.     it('should return undefined with a floating point number as a second parameter', function () {
  12.         expect(charLookup("test", 3.12)).to.equal(undefined, "The function did not return correct result");
  13.     });
  14.     it(' should return incorrect index with an incorrect index as a value', function () {
  15.         expect(charLookup("test", 13)).to.equal("Incorrect index", "The function did not return correct result");
  16.     });
  17.     it(' should return incorrect index with a negative index as a value', function () {
  18.         expect(charLookup("test", -1)).to.equal("Incorrect index", "The function did not return correct result");
  19.     });
  20.     it('with an index value equal to string length, should return incorrect index', function () {
  21.         expect(charLookup("pesho", 5)).to.equal("Incorrect index", "The function did not return correct result");
  22.     });
  23.     it(' should return incorrect index with an index equal to string length', function () {
  24.         expect(charLookup("test", 4)).to.equal("Incorrect index", "The function did not return correct result");
  25.     });
  26.     it('should return correct value with correct parameters', function () {
  27.         expect(charLookup("Rest", 0)).to.equal("R", "The function did not return correct result");
  28.     });
  29.     it('with correct parameters should return correct value', function () {
  30.         expect(charLookup("testing", 5)).to.equal("n", "The function did not return correct result");
  31.     });
  32. });
Add Comment
Please, Sign In to add comment