1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-02-14 21:10:41 +01:00
portfolio/src/components/Vcard/index.test.tsx
Matthias Kretschmann 447cada700
Migrate to Next.js + TypeScript (#1038)
* next.js + typescript

* more testing

* script updates

* fixes

* favicon generation

* testing

* readme updates

* tweaks

* tweaks

* move tests

* image tweaks

* ci tweaks

* commit next-env.d.ts for ci

* migrations

* fixes

* fixes

* ci tweaks

* new animations

* project preview tweaks

* add codeclimate config

* dark mode refactor, test tweaks

* readme updates

* animation tweaks

* animate in loaded images

* test update

* update humans.txt
2022-11-15 23:14:59 +00:00

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)
})
})