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
3b7ea6b6
Commit
3b7ea6b6
authored
Mar 04, 2020
by
Donald Cook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mutation test
parent
49a4cc3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/mutations.js
+2
-2
spec/frontend/notes/stores/mutation_spec.js
spec/frontend/notes/stores/mutation_spec.js
+24
-0
No files found.
app/assets/javascripts/notes/stores/mutations.js
View file @
3b7ea6b6
...
...
@@ -298,9 +298,9 @@ export default {
[
types
.
REQUEST_DELETE_DESCRIPTION_VERSION
](
state
)
{
state
.
isLoadingDescriptionVersion
=
true
;
},
[
types
.
RECEIVE_DELETE_DESCRIPTION_VERSION
](
state
,
versionId
)
{
[
types
.
RECEIVE_DELETE_DESCRIPTION_VERSION
](
state
,
descriptionVersion
)
{
state
.
isLoadingDescriptionVersion
=
false
;
Object
.
assign
(
state
.
descriptionVersions
,
versionId
);
Object
.
assign
(
state
.
descriptionVersions
,
descriptionVersion
);
},
[
types
.
RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR
](
state
)
{
state
.
isLoadingDescriptionVersion
=
false
;
...
...
spec/frontend/notes/stores/mutation_spec.js
View file @
3b7ea6b6
...
...
@@ -8,6 +8,7 @@ import {
userDataMock
,
noteableDataMock
,
individualNote
,
notesWithDescriptionChanges
,
}
from
'
../mock_data
'
;
const
RESOLVED_NOTE
=
{
resolvable
:
true
,
resolved
:
true
};
...
...
@@ -579,4 +580,27 @@ describe('Notes Store mutations', () => {
expect
(
state
.
convertedDisscussionIds
).
not
.
toContain
(
discussion
.
id
);
});
});
describe
(
'
RECEIVE_DESCRIPTION_VERSION
'
,
()
=>
{
const
descriptionVersion
=
notesWithDescriptionChanges
[
0
].
notes
[
0
].
note
;
const
versionId
=
notesWithDescriptionChanges
[
0
].
notes
[
0
].
id
;
const
state
=
{};
it
(
'
adds a descriptionVersion
'
,
()
=>
{
mutations
.
RECEIVE_DESCRIPTION_VERSION
(
state
,
{
descriptionVersion
,
versionId
});
expect
(
state
.
descriptionVersions
[
versionId
]).
toContain
(
descriptionVersion
);
});
});
describe
(
'
RECEIVE_DELETE_DESCRIPTION_VERSION
'
,
()
=>
{
const
descriptionVersion
=
notesWithDescriptionChanges
[
0
].
notes
[
0
].
note
;
const
versionId
=
notesWithDescriptionChanges
[
0
].
notes
[
0
].
id
;
const
state
=
{
descriptionVersions
:
{
[
versionId
]:
descriptionVersion
}
};
const
deleted
=
'
Deleted
'
;
it
(
'
updates descriptionVersion to "Deleted"
'
,
()
=>
{
mutations
.
RECEIVE_DELETE_DESCRIPTION_VERSION
(
state
,
{
[
versionId
]:
deleted
});
expect
(
state
.
descriptionVersions
[
versionId
]).
toContain
(
deleted
);
});
});
});
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