Skip to content

Commit a3c3b1d

Browse files
committed
unit: more tests for form mutations
1 parent 7a56812 commit a3c3b1d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/helpers/state-machine/form/mutations/__tests__/form-state-mutations.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,13 @@ describe('FormMutations', () => {
8282
const expected = {"activeStep": 0, "formData": {"test": "test-2"}, "formSchema": {}, "formSchemaXHR": {"new": "info"}, "hasError": false, "hasXHRError": false, "lastField": "test", "parsedFormSchema": {}, "uiData": {}, "uiSchema": {}, "validation": {}, "validations": {}, "xhrProgress": {"undefined": false}, "xhrSchema": {}};
8383
expect(contextMutations).toStrictEqual(expected);
8484
});
85+
86+
it('updateXHRData (edge case)', () => {
87+
const updateMutation = stateMachineService.send('updateFormOnXHRComplete', {});
88+
const contextMutations = JSON.parse(JSON.stringify(updateMutation.context));
89+
delete contextMutations.effects;
90+
const expected = {"activeStep": 0, "formData": {"test": "test-2"}, "formSchema": {}, "formSchemaXHR": {"new": "info"}, "hasError": false, "hasXHRError": false, "lastField": "test", "parsedFormSchema": {}, "uiData": {}, "uiSchema": {}, "validation": {}, "validations": {}, "xhrProgress": {"undefined": false}, "xhrSchema": {}};
91+
expect(contextMutations).toStrictEqual(expected);
92+
});
8593
});
8694
});

0 commit comments

Comments
 (0)