Fakultas Ilmu Komputer UI

Commit 0232440d authored by Shafiya Adzhani's avatar Shafiya Adzhani
Browse files

[RED] add test for wajib diisi status entitas error

parent 29dcb50d
Pipeline #72329 canceled with stages
import {screen, waitFor} from '@testing-library/react'
import {screen, waitFor, fireEvent} from '@testing-library/react'
import FormIUMK from '../../pages/formiumk'
import {testRender, makeTestStore, fixtureSet} from '../../testUtils'
import userEvent from '@testing-library/user-event'
......@@ -29,6 +29,27 @@ test('error message for empty name displayed', async () => {
})
})
test('error message for empty status entitas', async () => {
const store = makeTestStore(fixtureSet)
testRender(<FormIUMK />, {store})
userEvent.type(screen.getByTestId('form-1-nama-field'), 'pt ABC')
expect(screen.getByTestId('form-1-nama-field')).toHaveValue('pt ABC')
userEvent.type(screen.getByTestId('form-1-alamat-field'), 'my alamat')
expect(screen.getByTestId('form-1-alamat-field')).toHaveValue('my alamat')
userEvent.type(screen.getByTestId('form-1-barang-jasa-field'), 'tukang bubur')
expect(screen.getByTestId('form-1-barang-jasa-field')).toHaveValue(
'tukang bubur',
)
let lanjutButton = screen.getByTestId('lanjut-button')
fireEvent.click(lanjutButton)
await waitFor(() => {
expect(screen.getByText(/Wajib diisi/i)).toBeInTheDocument()
})
})
test('error message for empty alamat displayed', async () => {
const store = makeTestStore(fixtureSet)
testRender(<FormIUMK />, {store})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment