Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
81944ec9
Commit
81944ec9
authored
Oct 25, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed action & mutation specs
parent
0fba7cca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
44 deletions
+29
-44
spec/javascripts/diffs/store/actions_spec.js
spec/javascripts/diffs/store/actions_spec.js
+1
-2
spec/javascripts/diffs/store/mutations_spec.js
spec/javascripts/diffs/store/mutations_spec.js
+28
-42
No files found.
spec/javascripts/diffs/store/actions_spec.js
View file @
81944ec9
...
@@ -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
'
,
...
...
spec/javascripts/diffs/store/mutations_spec.js
View file @
81944ec9
...
@@ -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
);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment