Created
November 19, 2024 00:14
-
-
Save nedgrady/09a9989286b096ec7854f90b006ca549 to your computer and use it in GitHub Desktop.
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
test("When the 'cancel' button is clicked, onClose is called", () => { | |
const mockOnClose = vi.fn() | |
render(<CustomModal onClose={mockOnClose} />) | |
const button = screen.getByRole("button", { name: /Cancel/i }) | |
userEvent.click(button) | |
expect(mockOnClose).toHaveBeenCalledWith("clicked cancel") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment