Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it("Function insertAt(string, index) - converts the passed in string argument to an array and adds it at the given index", function (){
- let sb = new StringBuilder("Test");
- sb.insertAt("New", 2)
- assert.equal(sb._stringArray.join(""), "TeNewst");
- });
- ------------------------------
- it("Passing string to insertAt function should add to the existing array at the specified index", function() {
- let strBuilder = new StringBuilder("abc");
- strBuilder.insertAt("def", 1);
- let actual = strBuilder._stringArray;
- let expected = ["a", "d", "e", "f", "b", "c"];
- actual.forEach((x, i) => {
- assert.equal(x, expected[i]);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement