Commit 1fc10388 authored by Samantha Ming's avatar Samantha Ming

Refactor validation spec by caching object

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/330691
parent 7368e2a6
......@@ -240,14 +240,16 @@ describe('initForm', () => {
},
};
const EXPECTED_FIELDS = {
name: { value: 'lorem', required: true, state: null, feedback: null },
description: { value: 'ipsum', required: false, state: true, feedback: null },
};
it('returns form object', () => {
expect(initForm(MOCK_FORM)).toMatchObject({
state: false,
showValidation: false,
fields: {
name: { value: 'lorem', required: true, state: null, feedback: null },
description: { value: 'ipsum', required: false, state: true, feedback: null },
},
fields: EXPECTED_FIELDS,
});
});
......@@ -266,10 +268,7 @@ describe('initForm', () => {
expect(initForm(form)).toMatchObject({
state: false,
showValidation: false,
fields: {
name: { value: 'lorem', required: true, state: null, feedback: null },
description: { value: 'ipsum', required: false, state: true, feedback: null },
},
fields: EXPECTED_FIELDS,
...customFormObject,
});
});
......@@ -284,10 +283,7 @@ describe('initForm', () => {
expect(initForm(form)).toMatchObject({
state: true,
showValidation: true,
fields: {
name: { value: 'lorem', required: true, state: null, feedback: null },
description: { value: 'ipsum', required: false, state: true, feedback: null },
},
fields: EXPECTED_FIELDS,
});
});
});
Markdown is supported
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