Fakultas Ilmu Komputer UI

Commit 8be24a1f authored by Lia Yuliana's avatar Lia Yuliana
Browse files

[RED] add handleSubmit and onSubmit test for Form IUMK 3

parent 09b8377d
Pipeline #72867 passed with stages
in 11 minutes and 24 seconds
...@@ -3,6 +3,9 @@ import FormIUMK3 from './FormIUMK3' ...@@ -3,6 +3,9 @@ import FormIUMK3 from './FormIUMK3'
import {testRender, makeTestStore} from '../../testUtils' import {testRender, makeTestStore} from '../../testUtils'
test('renders FormIUMK3 Element', () => { test('renders FormIUMK3 Element', () => {
const handleSubmit = jest.fn()
const onSubmit = jest.fn()
const data = { const data = {
nama: 'PT UUN', nama: 'PT UUN',
alamat: 'Jakarta', alamat: 'Jakarta',
...@@ -13,7 +16,10 @@ test('renders FormIUMK3 Element', () => { ...@@ -13,7 +16,10 @@ test('renders FormIUMK3 Element', () => {
catatan: null, catatan: null,
} }
const store = makeTestStore() const store = makeTestStore()
testRender(<FormIUMK3 data={data} />, {store}) testRender(
<FormIUMK3 data={data} handleSubmit={handleSubmit} onSubmit={onSubmit} />,
{store},
)
expect(screen.getByTestId('form-iumk-3')).toBeInTheDocument() expect(screen.getByTestId('form-iumk-3')).toBeInTheDocument()
// Test label // Test label
...@@ -48,6 +54,9 @@ test('renders FormIUMK3 Element', () => { ...@@ -48,6 +54,9 @@ test('renders FormIUMK3 Element', () => {
}) })
test('renders FormIUMK3 Element with catatan', () => { test('renders FormIUMK3 Element with catatan', () => {
const handleSubmit = jest.fn()
const onSubmit = jest.fn()
const data = { const data = {
nama: 'PT UUN', nama: 'PT UUN',
alamat: 'Jakarta', alamat: 'Jakarta',
...@@ -58,7 +67,10 @@ test('renders FormIUMK3 Element with catatan', () => { ...@@ -58,7 +67,10 @@ test('renders FormIUMK3 Element with catatan', () => {
catatan: 'Contoh catatan', catatan: 'Contoh catatan',
} }
const store = makeTestStore() const store = makeTestStore()
testRender(<FormIUMK3 data={data} />, {store}) testRender(
<FormIUMK3 data={data} handleSubmit={handleSubmit} onSubmit={onSubmit} />,
{store},
)
expect(screen.getByTestId('form-iumk-3')).toBeInTheDocument() expect(screen.getByTestId('form-iumk-3')).toBeInTheDocument()
expect(screen.getByTestId('form-iumk-3-input-catatan')).toBeInTheDocument() expect(screen.getByTestId('form-iumk-3-input-catatan')).toBeInTheDocument()
......
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