Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. it("Function insertAt(string, index) - converts the passed in string argument to an array and adds it at the given index", function (){
  2.         let sb = new StringBuilder("Test");
  3.         sb.insertAt("New", 2)
  4.         assert.equal(sb._stringArray.join(""), "TeNewst");
  5.     });
  6. ------------------------------
  7. it("Passing string to insertAt function should add to the existing array at the specified index", function() {
  8.         let strBuilder = new StringBuilder("abc");
  9.         strBuilder.insertAt("def", 1);
  10.         let actual = strBuilder._stringArray;
  11.         let expected = ["a", "d", "e", "f", "b", "c"];
  12.         actual.forEach((x, i) => {
  13.           assert.equal(x, expected[i]);
  14.         });
  15.       });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement