test: replacement coverage for the deleted legacy suites (v3 schema rejections, appointment kinds, i18n keys and placeholders, pickLocaleLabel, region mapping, new report route); importer comment
This commit is contained in:
1 parent
09d8b01a54
commit
06a2e86f3c
5 files changed
+242
-1
No files matched your search
@@ -0,0 +1,40 @@
|
||||
/** The new-report form on the bundled sheet: species select, submit gate. */
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { cleanup, render, screen, waitFor } from '@testing-library/react'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import NewReportRoute from '@/app/routes/NewReportRoute'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
import { fr } from '@/i18n/fr'
|
||||
|
||||
beforeEach(() => {
|
||||
useLocaleStore.setState({ locale: 'fr' })
|
||||
localStorage.clear()
|
||||
})
|
||||
afterEach(cleanup)
|
||||
|
||||
function mount() {
|
||||
return render(
|
||||
<MemoryRouter initialEntries={['/new']}>
|
||||
<NewReportRoute />
|
||||
</MemoryRouter>,
|
||||
)
|
||||
}
|
||||
|
||||
describe('NewReportRoute', () => {
|
||||
it('selects equine and names it once the sheet is loaded', async () => {
|
||||
mount()
|
||||
const select = screen.getByLabelText(
|
||||
fr['form.animal.species'],
|
||||
) as HTMLSelectElement
|
||||
await waitFor(() => {
|
||||
expect(select.value).toBe('equine')
|
||||
expect(select.selectedOptions[0]?.textContent).toBe('Cheval')
|
||||
})
|
||||
})
|
||||
|
||||
it('disables submit while the names are empty', async () => {
|
||||
mount()
|
||||
const button = screen.getByRole('button', { name: fr['new_report.submit'] })
|
||||
await waitFor(() => expect(button).toBeDisabled())
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user