1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
import commitState from '~/ide/stores/modules/commit/state';
import mutations from '~/ide/stores/modules/commit/mutations';
describe('IDE commit module mutations', () => {
let state;
beforeEach(() => {
state = commitState();
});
describe('UPDATE_COMMIT_MESSAGE', () => {
it('updates commitMessage', () => {
mutations.UPDATE_COMMIT_MESSAGE(state, 'testing');
expect(state.commitMessage).toBe('testing');
});
});
describe('UPDATE_COMMIT_ACTION', () => {
it('updates commitAction', () => {
mutations.UPDATE_COMMIT_ACTION(state, { commitAction: 'testing' });
expect(state.commitAction).toBe('testing');
});
});
describe('UPDATE_NEW_BRANCH_NAME', () => {
it('updates newBranchName', () => {
mutations.UPDATE_NEW_BRANCH_NAME(state, 'testing');
expect(state.newBranchName).toBe('testing');
});
});
describe('UPDATE_LOADING', () => {
it('updates submitCommitLoading', () => {
mutations.UPDATE_LOADING(state, true);
expect(state.submitCommitLoading).toBeTruthy();
});
});
describe('TOGGLE_SHOULD_CREATE_MR', () => {
it('changes shouldCreateMR to true when initial state is false', () => {
state.shouldCreateMR = false;
mutations.TOGGLE_SHOULD_CREATE_MR(state);
expect(state.shouldCreateMR).toBe(true);
});
it('changes shouldCreateMR to false when initial state is true', () => {
state.shouldCreateMR = true;
mutations.TOGGLE_SHOULD_CREATE_MR(state);
expect(state.shouldCreateMR).toBe(false);
});
it('sets shouldCreateMR to given value when passed in', () => {
state.shouldCreateMR = false;
mutations.TOGGLE_SHOULD_CREATE_MR(state, false);
expect(state.shouldCreateMR).toBe(false);
});
});
describe('INTERACT_WITH_NEW_MR', () => {
it('sets interactedWithNewMR to true', () => {
mutations.INTERACT_WITH_NEW_MR(state);
expect(state.interactedWithNewMR).toBe(true);
});
});
});
|