mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-02-14 21:10:41 +01:00
22 lines
625 B
TypeScript
22 lines
625 B
TypeScript
|
import { render, fireEvent, waitFor, screen } from '@testing-library/react'
|
||
|
import Vcard from '.'
|
||
|
|
||
|
describe('Vcard', () => {
|
||
|
beforeEach(() => {
|
||
|
global.URL.createObjectURL = jest.fn()
|
||
|
})
|
||
|
|
||
|
it('renders correctly', () => {
|
||
|
const { container } = render(<Vcard />)
|
||
|
expect(container.firstChild).toBeInTheDocument()
|
||
|
})
|
||
|
|
||
|
it('Button click starts download', async () => {
|
||
|
render(<Vcard />)
|
||
|
const button = await screen.findByText('Add to addressbook')
|
||
|
fireEvent.click(button)
|
||
|
await waitFor(() => global.URL.createObjectURL)
|
||
|
// expect(global.URL.createObjectURL).toHaveBeenCalledTimes(1)
|
||
|
})
|
||
|
})
|