Created
September 15, 2022 14:44
-
-
Save Clarity-89/001cabc13b0ebc1b28313abffdb56e82 to your computer and use it in GitHub Desktop.
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("Form", () => { | |
it("should save correct data on submit", async () => { | |
const mockSave = jest.fn(); | |
render(<Form saveData={mockSave} />); | |
await userEvent.type(screen.getByRole("textbox", { name: "Name" }), "Test"); | |
await userEvent.click(screen.getByRole("button", { name: "Sign up" })); | |
expect(mockSave).toHaveBeenLastCalledWith({ ...defaultData, name: "Test" }); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment