Last active
May 29, 2019 09:52
-
-
Save lfac-pt/22e22b87b962f4e73709bf54be416b10 to your computer and use it in GitHub Desktop.
Example 4 of my JavaScript and React unit tests basics
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 characters
describe("deletePost", () => { | |
test("calls the REST API method to delete the post", () => { | |
// Setup | |
const mockUser = new User({ username: "bob" }); | |
mockUser.ajax = spy(); | |
mockUser.login(); | |
// Action | |
mockUser.deletePost(); | |
// Assertion | |
expect(mockUser.ajax).to.haveCallCount(1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment