Created
September 15, 2022 14:43
-
-
Save Clarity-89/17b3000136da80e4793ddcc80134433b 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", () => { | |
const mockSave = jest.fn(); | |
render(<Form saveData={mockSave} />); | |
fireEvent.change(screen.getByRole("textbox", { name: "Name" }), { | |
target: { value: "Test" }, | |
}); | |
fireEvent.submit(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