-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
258 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { includes } from "./includes"; | ||
|
||
describe("includes", () => { | ||
it("returns true if the item is in the array", () => { | ||
expect(includes([1, 2, 3], 2)).toBe(true); | ||
}); | ||
|
||
it("returns false if the item is not in the array", () => { | ||
expect(includes([1, 2, 3], 4)).toBe(false); | ||
}); | ||
|
||
it("throws an error if the first argument is not an array or string", () => { | ||
expect(() => includes(123, 1)).toThrow(); | ||
}); | ||
|
||
it("returns true if the string contains the substring", () => { | ||
expect(includes("hello-world", "world")).toBe(true); | ||
}); | ||
|
||
it("returns false if the string does not contain the substring", () => { | ||
expect(includes("hello-world", "goodbye")).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.