Created
November 18, 2017 03:47
-
-
Save flackend/af6b41e6f55dfa7ee59a249480f963af to your computer and use it in GitHub Desktop.
Revisions
-
flackend created this gist
Nov 18, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ describe("anyOtherFunctionName", function() { it("should not use indexOf", function() { var body = anyOtherFunctionName.toString(); expect(/indexOf/.test(body)).toBe(false); expect(anyOtherFunctionName("a", "I am a hacker")).toBe(2); }); it("should return a number", function() { expect(typeof anyOtherFunctionName("a", "I am a hacker")).toBe("number"); }); it("should return the index of the first occurence of a string", function() { expect(anyOtherFunctionName("a", "I am a hacker")).toBe(2); }); it("should return -1 when the character does not occur in the string", function() { expect(anyOtherFunctionName("x", "I am a hacker")).toBe(-1); }); });