Skip to content

Commit fc1f6b5

Browse files
committed
unit: more tests for stepper mutations
1 parent 9053777 commit fc1f6b5

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Import
2+
import FormMutations from '../form-state.mutations';
3+
4+
describe('FormMutations', () => {
5+
[
6+
'updateData',
7+
'updateXHRData',
8+
'updateXHRProgress',
9+
'updateErrorXHRProgress',
10+
'updateArrayData',
11+
'updateErrorData',
12+
'updateTabIndex'
13+
].forEach((actionName) => {
14+
it(`Should be able to execute ${actionName}`, () => {
15+
const fieldStates = FormMutations[actionName];
16+
const expected = '{\"type\":\"xstate.assign\",\"assignment\":{}}';
17+
expect(JSON.stringify(fieldStates)).toBe(expected);
18+
});
19+
});
20+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Import
2+
import StepperMutations from '../stepper-state.mutations';
3+
4+
describe('StepperMutations', () => {
5+
[
6+
'updateActiveStep'
7+
].forEach((actionName) => {
8+
it(`Should be able to execute ${actionName}`, () => {
9+
const fieldStates = StepperMutations[actionName];
10+
const expected = '{\"type\":\"xstate.assign\",\"assignment\":{}}';
11+
expect(JSON.stringify(fieldStates)).toBe(expected);
12+
});
13+
});
14+
});

0 commit comments

Comments
 (0)