Last active
May 29, 2019 10:01
-
-
Save lfac-pt/65fca3674d1d5efeeb7013c9a5073150 to your computer and use it in GitHub Desktop.
Example 6 of my JavaScript and React unit tests basics
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
describe("searchPosts", () => { | |
test("filters the results according to the input search", () => { | |
const mockUser = new User({ username: "bob" }); | |
mockUser.loadPosts = () => [{id: 1, title: "bob"}, {id: 2, title: "alice"}]; | |
expect(mockUser.searchPosts("bob")).toEqual([{id: 1, title: "bob"}]); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment