Skip to content
Snippets Groups Projects
Commit 97ea6fb2 authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-60: Fixing broken test

parent f6256b8b
No related branches found
No related tags found
1 merge request!74GREG-60: Org unit and material UI date picker
Pipeline #95076 failed
......@@ -3,6 +3,8 @@ import { render, waitFor, screen } from 'test-utils'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import userEvent from '@testing-library/user-event'
import AdapterDateFns from '@mui/lab/AdapterDateFns'
import { LocalizationProvider } from '@mui/lab'
import Register from './index'
// TODO: can this be initialized in 'test-utils'? should we stub it?
......@@ -21,7 +23,10 @@ i18n.use(initReactI18next).init({
})
test('Validation message showing if last name is missing', async () => {
render(<Register />)
render(
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Register />
</LocalizationProvider>)
const firstNameLabel = i18n.t('input.firstName').toString()
const firstNameComponent = screen.getByLabelText(firstNameLabel)
......@@ -29,8 +34,8 @@ test('Validation message showing if last name is missing', async () => {
userEvent.type(firstNameComponent, 'Test')
// Try to submit the form and check that the validation message is showing
const submitButton = screen.getByTestId('register-submit')
// Try to go to the next step and check that the validation message is showing
const submitButton = screen.getByTestId('register-next')
userEvent.click(submitButton)
const validationLastName = i18n
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment