Commit 81944ec9 authored by Phil Hughes's avatar Phil Hughes

Fixed action & mutation specs

parent 0fba7cca
...@@ -161,8 +161,7 @@ describe('DiffsStoreActions', () => { ...@@ -161,8 +161,7 @@ describe('DiffsStoreActions', () => {
{ {
type: types.SET_LINE_DISCUSSIONS_FOR_FILE, type: types.SET_LINE_DISCUSSIONS_FOR_FILE,
payload: { payload: {
diffFile: state.diffFiles[0], discussion: singleDiscussion,
discussions: [singleDiscussion],
diffPositionByLineCode: { diffPositionByLineCode: {
ABC_1_1: { ABC_1_1: {
baseSha: 'abc', baseSha: 'abc',
......
...@@ -198,40 +198,32 @@ describe('DiffsStoreMutations', () => { ...@@ -198,40 +198,32 @@ describe('DiffsStoreMutations', () => {
}, },
], ],
}; };
const discussions = [ const discussion = {
{
id: 1, id: 1,
line_code: 'ABC_1', line_code: 'ABC_1',
diff_discussion: true, diff_discussion: true,
resolvable: true, resolvable: true,
original_position: diffPosition, original_position: diffPosition,
position: diffPosition, position: diffPosition,
diff_file: {
file_hash: state.diffFiles[0].fileHash,
}, },
{ };
id: 2,
line_code: 'ABC_1',
diff_discussion: true,
resolvable: true,
original_position: diffPosition,
position: diffPosition,
},
];
const diffPositionByLineCode = { const diffPositionByLineCode = {
ABC_1: diffPosition, ABC_1: diffPosition,
}; };
mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, {
diffFile: state.diffFiles[0], discussion,
discussions,
diffPositionByLineCode, diffPositionByLineCode,
}); });
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(2); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(1);
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[1].id).toEqual(2); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[0].id).toEqual(1);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(2); expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(1);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions[1].id).toEqual(2); expect(state.diffFiles[0].highlightedDiffLines[0].discussions[0].id).toEqual(1);
}); });
it('should add legacy discussions to the given line', () => { it('should add legacy discussions to the given line', () => {
...@@ -272,36 +264,30 @@ describe('DiffsStoreMutations', () => { ...@@ -272,36 +264,30 @@ describe('DiffsStoreMutations', () => {
}, },
], ],
}; };
const discussions = [ const discussion = {
{
id: 1, id: 1,
line_code: 'ABC_1', line_code: 'ABC_1',
diff_discussion: true, diff_discussion: true,
active: true, active: true,
diff_file: {
file_hash: state.diffFiles[0].fileHash,
}, },
{ };
id: 2,
line_code: 'ABC_1',
diff_discussion: true,
active: true,
},
];
const diffPositionByLineCode = { const diffPositionByLineCode = {
ABC_1: diffPosition, ABC_1: diffPosition,
}; };
mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, { mutations[types.SET_LINE_DISCUSSIONS_FOR_FILE](state, {
diffFile: state.diffFiles[0], discussion,
discussions,
diffPositionByLineCode, diffPositionByLineCode,
}); });
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(2); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(1);
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[1].id).toEqual(2); expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[0].id).toEqual(1);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(2); expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(1);
expect(state.diffFiles[0].highlightedDiffLines[0].discussions[1].id).toEqual(2); expect(state.diffFiles[0].highlightedDiffLines[0].discussions[0].id).toEqual(1);
}); });
}); });
......
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