Files
supabase/apps/studio/tests/components/CopyButton.test.tsx
Ivan Vasilov cb1e3a8170 chore: Prep work for pnpm (#29610)
* Add all missing libraries in the packages/apps.

* Add all missing Vitest imports to the tests.

* Add some missing exports to ui.

* Fix the admonition export.

* Fix various minor bugs.

* Migrate the ui package to use vitest.
2024-10-01 11:29:37 +02:00

15 lines
481 B
TypeScript

import { expect, test, vi } from 'vitest'
import { screen } from '@testing-library/dom'
import userEvent from '@testing-library/user-event'
import CopyButton from 'components/ui/CopyButton'
import { render } from 'tests/helpers'
test('shows copied text', async () => {
const callback = vi.fn()
render(<CopyButton text="some text" onClick={callback} />)
userEvent.click(await screen.findByText('Copy'))
await screen.findByText('Copied')
expect(callback).toBeCalled()
})