Skip to content

Commit

Permalink
update tests to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Sep 21, 2024
1 parent a5c5504 commit 96617ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 58 deletions.
58 changes: 0 additions & 58 deletions src/ui/TextInput/TextInput.spec.tsx

This file was deleted.

32 changes: 32 additions & 0 deletions src/ui/TextInput/TextInput.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { render, screen } from '@testing-library/react'

import TextInput from './TextInput'

describe('TextInput', () => {
describe('when rendered', () => {
it('renders the textbox with the name of the label', () => {
render(<TextInput label="label" />)

const textbox = screen.getByRole('textbox', { name: /label/i })
expect(textbox).toBeInTheDocument()
})
})

describe('when rendered without label', () => {
it('renders the textbox with the placeholder as the label', () => {
render(<TextInput placeholder="search orgs" />)

const textbox = screen.getByRole('textbox', { name: /search orgs/i })
expect(textbox).toBeInTheDocument()
})
})

describe('when rendered with icon', () => {
it('renders an icon', () => {
render(<TextInput icon="search" />)

const icon = screen.getByTestId('search')
expect(icon).toBeInTheDocument()
})
})
})

0 comments on commit 96617ba

Please sign in to comment.