Commit 45cf5194 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '330691-refactor-validation-directive-spec' into 'master'

Refactor validation spec by caching object

See merge request gitlab-org/gitlab!61770
parents 50b001a2 1fc10388
......@@ -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