Created
February 11, 2026 19:01
-
-
Save claudiainbytes/ea03e314914ad674981bf77ecf303a94 to your computer and use it in GitHub Desktop.
Testing File Upload
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
| it('sube archivo', async () => { | |
| const user = userEvent.setup() | |
| const handleUpload = vi.fn() | |
| render(<FileUpload onUpload={handleUpload} />) | |
| const file = new File(['hello'], 'hello.png', { type: 'image/png' }) | |
| const input = screen.getByLabelText(/upload/i) | |
| await user.upload(input, file) | |
| expect(handleUpload).toHaveBeenCalledWith( | |
| expect.objectContaining({ | |
| name: 'hello.png', | |
| type: 'image/png', | |
| }) | |
| ) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment