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
042ad267
Commit
042ad267
authored
Jan 19, 2021
by
Mark Florian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify mocked promises
parent
151965b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
+3
-10
No files found.
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
View file @
042ad267
...
...
@@ -17,13 +17,6 @@ jest.mock('~/smart_interval');
jest
.
mock
(
'
~/lib/utils/favicon
'
);
const
returnPromise
=
(
data
)
=>
new
Promise
((
resolve
)
=>
{
resolve
({
data
,
});
});
describe
(
'
MrWidgetOptions
'
,
()
=>
{
let
wrapper
;
let
mock
;
...
...
@@ -281,7 +274,7 @@ describe('MrWidgetOptions', () => {
let
isCbExecuted
;
beforeEach
(()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
service
,
'
checkStatus
'
).
mockRe
turnValue
(
returnPromise
(
mockData
)
);
jest
.
spyOn
(
wrapper
.
vm
.
service
,
'
checkStatus
'
).
mockRe
solvedValue
({
data
:
mockData
}
);
jest
.
spyOn
(
wrapper
.
vm
.
mr
,
'
setData
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
handleNotification
'
).
mockImplementation
(()
=>
{});
...
...
@@ -331,7 +324,7 @@ describe('MrWidgetOptions', () => {
it
(
'
should fetch deployments
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
service
,
'
fetchDeployments
'
)
.
mockRe
turnValue
(
returnPromise
([{
id
:
1
,
status
:
SUCCESS
}])
);
.
mockRe
solvedValue
({
data
:
[{
id
:
1
,
status
:
SUCCESS
}]
}
);
wrapper
.
vm
.
fetchPreMergeDeployments
();
...
...
@@ -347,7 +340,7 @@ describe('MrWidgetOptions', () => {
it
(
'
should fetch content of Cherry Pick and Revert modals
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
service
,
'
fetchMergeActionsContent
'
)
.
mockRe
turnValue
(
returnPromise
(
'
hello world
'
)
);
.
mockRe
solvedValue
({
data
:
'
hello world
'
}
);
wrapper
.
vm
.
fetchActionsContent
();
...
...
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