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
88c6e9a4
Commit
88c6e9a4
authored
Jun 08, 2020
by
Eulyeon Ko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for softDeleteDescriptionVersion
parent
e7d6bb8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
spec/frontend/notes/stores/actions_spec.js
spec/frontend/notes/stores/actions_spec.js
+58
-0
No files found.
spec/frontend/notes/stores/actions_spec.js
View file @
88c6e9a4
...
...
@@ -942,4 +942,62 @@ describe('Actions Notes Store', () => {
);
});
});
describe
(
'
softDeleteDescriptionVersion
'
,
()
=>
{
const
endpoint
=
'
/path/to/diff/1
'
;
const
payload
=
{
endpoint
,
startingVersion
:
undefined
,
versionId
:
1
,
};
describe
(
'
if response contains no errors
'
,
()
=>
{
it
(
'
dispatches requestDeleteDescriptionVersion
'
,
done
=>
{
axiosMock
.
onDelete
(
endpoint
).
replyOnce
(
200
);
testAction
(
actions
.
softDeleteDescriptionVersion
,
payload
,
{},
[],
[
{
type
:
'
requestDeleteDescriptionVersion
'
,
},
{
type
:
'
receiveDeleteDescriptionVersion
'
,
payload
:
payload
.
versionId
,
},
],
done
,
);
});
});
describe
(
'
if response contains errors
'
,
()
=>
{
const
errorMessage
=
'
Request failed with status code 503
'
;
it
(
'
dispatches receiveDeleteDescriptionVersionError and throws an error
'
,
done
=>
{
axiosMock
.
onDelete
(
endpoint
).
replyOnce
(
503
);
testAction
(
actions
.
softDeleteDescriptionVersion
,
payload
,
{},
[],
[
{
type
:
'
requestDeleteDescriptionVersion
'
,
},
{
type
:
'
receiveDeleteDescriptionVersionError
'
,
payload
:
new
Error
(
errorMessage
),
},
],
)
.
then
(()
=>
done
.
fail
(
'
Expected error to be thrown
'
))
.
catch
(()
=>
{
expect
(
Flash
).
toHaveBeenCalled
();
done
();
});
});
});
});
});
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