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
dff561fa
Commit
dff561fa
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 35 files - 70 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
19b0ba72
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
140 additions
and
177 deletions
+140
-177
.prettierignore
.prettierignore
+0
-37
spec/frontend/user_popovers_spec.js
spec/frontend/user_popovers_spec.js
+2
-2
spec/frontend/vue_alerts_spec.js
spec/frontend/vue_alerts_spec.js
+4
-4
spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js
...tend/vue_mr_widget/components/approvals/approvals_spec.js
+18
-18
spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js
..._mr_widget/components/approvals/approvals_summary_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/artifacts_list_spec.js
.../frontend/vue_mr_widget/components/artifacts_list_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
...vue_mr_widget/components/mr_collapsible_extension_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js
.../vue_mr_widget/components/mr_widget_alert_message_spec.js
+5
-5
spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
...rontend/vue_mr_widget/components/mr_widget_header_spec.js
+2
-2
spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js
...d/vue_mr_widget/components/mr_widget_memory_usage_spec.js
+6
-6
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
...mr_widget/components/mr_widget_pipeline_container_spec.js
+4
-4
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
...ntend/vue_mr_widget/components/mr_widget_pipeline_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js
...rontend/vue_mr_widget/components/mr_widget_rebase_spec.js
+2
-2
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
.../vue_mr_widget/components/mr_widget_related_links_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
...et/components/states/mr_widget_auto_merge_enabled_spec.js
+9
-9
spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js
...widget/components/states/mr_widget_commits_header_spec.js
+4
-4
spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
...e_mr_widget/components/states/mr_widget_conflicts_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
...idget/components/states/mr_widget_failed_to_merge_spec.js
+4
-4
spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js
.../vue_mr_widget/components/states/mr_widget_merged_spec.js
+5
-5
spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
...widget/components/states/mr_widget_missing_branch_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+16
-16
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
...t/components/states/mr_widget_squash_before_merge_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js
...end/vue_mr_widget/components/states/mr_widget_wip_spec.js
+3
-3
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
...omponents/terraform/mr_widget_terraform_container_spec.js
+1
-1
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
...vue_mr_widget/components/terraform/terraform_plan_spec.js
+1
-1
spec/frontend/vue_mr_widget/deployment/deployment_spec.js
spec/frontend/vue_mr_widget/deployment/deployment_spec.js
+2
-2
spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js
...d/vue_mr_widget/deployment/deployment_view_button_spec.js
+1
-1
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
+22
-22
spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js
...ntend/vue_mr_widget/stores/artifacts_list/actions_spec.js
+7
-7
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
+1
-1
spec/frontend/vue_shared/components/actions_button_spec.js
spec/frontend/vue_shared/components/actions_button_spec.js
+2
-2
spec/frontend/vue_shared/components/alert_details_table_spec.js
...rontend/vue_shared/components/alert_details_table_spec.js
+3
-3
spec/frontend/vue_shared/components/awards_list_spec.js
spec/frontend/vue_shared/components/awards_list_spec.js
+3
-3
spec/frontend/vue_shared/components/ci_badge_link_spec.js
spec/frontend/vue_shared/components/ci_badge_link_spec.js
+1
-1
spec/frontend/vue_shared/components/commit_spec.js
spec/frontend/vue_shared/components/commit_spec.js
+3
-3
spec/frontend/vue_shared/components/confirm_modal_spec.js
spec/frontend/vue_shared/components/confirm_modal_spec.js
+1
-1
No files found.
.prettierignore
View file @
dff561fa
...
@@ -2256,43 +2256,6 @@ spec/frontend/shared/popover_spec.js
...
@@ -2256,43 +2256,6 @@ spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_spec.js
spec/frontend/shortcuts_spec.js
spec/frontend/sidebar/assignee_title_spec.js
spec/frontend/sidebar/assignee_title_spec.js
## priceless-margulis
spec/frontend/user_popovers_spec.js
spec/frontend/vue_alerts_spec.js
spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js
spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js
spec/frontend/vue_mr_widget/components/artifacts_list_spec.js
spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
spec/frontend/vue_mr_widget/deployment/deployment_spec.js
spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
spec/frontend/vue_shared/components/actions_button_spec.js
spec/frontend/vue_shared/components/alert_details_table_spec.js
spec/frontend/vue_shared/components/awards_list_spec.js
spec/frontend/vue_shared/components/ci_badge_link_spec.js
spec/frontend/vue_shared/components/commit_spec.js
spec/frontend/vue_shared/components/confirm_modal_spec.js
## trusting-antonelli
## trusting-antonelli
spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js
spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js
...
...
spec/frontend/user_popovers_spec.js
View file @
dff561fa
...
@@ -26,12 +26,12 @@ describe('User Popovers', () => {
...
@@ -26,12 +26,12 @@ describe('User Popovers', () => {
loadFixtures
(
fixtureTemplate
);
loadFixtures
(
fixtureTemplate
);
const
usersCacheSpy
=
()
=>
Promise
.
resolve
(
dummyUser
);
const
usersCacheSpy
=
()
=>
Promise
.
resolve
(
dummyUser
);
jest
.
spyOn
(
UsersCache
,
'
retrieveById
'
).
mockImplementation
(
userId
=>
usersCacheSpy
(
userId
));
jest
.
spyOn
(
UsersCache
,
'
retrieveById
'
).
mockImplementation
(
(
userId
)
=>
usersCacheSpy
(
userId
));
const
userStatusCacheSpy
=
()
=>
Promise
.
resolve
(
dummyUserStatus
);
const
userStatusCacheSpy
=
()
=>
Promise
.
resolve
(
dummyUserStatus
);
jest
jest
.
spyOn
(
UsersCache
,
'
retrieveStatusById
'
)
.
spyOn
(
UsersCache
,
'
retrieveStatusById
'
)
.
mockImplementation
(
userId
=>
userStatusCacheSpy
(
userId
));
.
mockImplementation
(
(
userId
)
=>
userStatusCacheSpy
(
userId
));
popovers
=
initUserPopovers
(
document
.
querySelectorAll
(
selector
));
popovers
=
initUserPopovers
(
document
.
querySelectorAll
(
selector
));
});
});
...
...
spec/frontend/vue_alerts_spec.js
View file @
dff561fa
...
@@ -27,7 +27,7 @@ describe('VueAlerts', () => {
...
@@ -27,7 +27,7 @@ describe('VueAlerts', () => {
setHTMLFixture
(
setHTMLFixture
(
alerts
alerts
.
map
(
.
map
(
x
=>
`
(
x
)
=>
`
<div class="js-vue-alert"
<div class="js-vue-alert"
data-dismissible="
${
x
.
dismissible
}
"
data-dismissible="
${
x
.
dismissible
}
"
data-title="
${
x
.
title
}
"
data-title="
${
x
.
title
}
"
...
@@ -42,15 +42,15 @@ describe('VueAlerts', () => {
...
@@ -42,15 +42,15 @@ describe('VueAlerts', () => {
const
findJsHooks
=
()
=>
document
.
querySelectorAll
(
'
.js-vue-alert
'
);
const
findJsHooks
=
()
=>
document
.
querySelectorAll
(
'
.js-vue-alert
'
);
const
findAlerts
=
()
=>
document
.
querySelectorAll
(
'
.gl-alert
'
);
const
findAlerts
=
()
=>
document
.
querySelectorAll
(
'
.gl-alert
'
);
const
findAlertDismiss
=
alert
=>
alert
.
querySelector
(
'
.gl-alert-dismiss
'
);
const
findAlertDismiss
=
(
alert
)
=>
alert
.
querySelector
(
'
.gl-alert-dismiss
'
);
const
serializeAlert
=
alert
=>
({
const
serializeAlert
=
(
alert
)
=>
({
title
:
alert
.
querySelector
(
'
.gl-alert-title
'
).
textContent
.
trim
(),
title
:
alert
.
querySelector
(
'
.gl-alert-title
'
).
textContent
.
trim
(),
html
:
alert
.
querySelector
(
'
.gl-alert-body div
'
).
innerHTML
,
html
:
alert
.
querySelector
(
'
.gl-alert-body div
'
).
innerHTML
,
dismissible
:
Boolean
(
alert
.
querySelector
(
'
.gl-alert-dismiss
'
)),
dismissible
:
Boolean
(
alert
.
querySelector
(
'
.gl-alert-dismiss
'
)),
primaryButtonText
:
alert
.
querySelector
(
'
.gl-alert-action
'
).
textContent
.
trim
(),
primaryButtonText
:
alert
.
querySelector
(
'
.gl-alert-action
'
).
textContent
.
trim
(),
primaryButtonLink
:
alert
.
querySelector
(
'
.gl-alert-action
'
).
href
,
primaryButtonLink
:
alert
.
querySelector
(
'
.gl-alert-action
'
).
href
,
variant
:
[...
alert
.
classList
].
find
(
x
=>
x
.
match
(
'
gl-alert-
'
)).
replace
(
'
gl-alert-
'
,
''
),
variant
:
[...
alert
.
classList
].
find
(
(
x
)
=>
x
.
match
(
'
gl-alert-
'
)).
replace
(
'
gl-alert-
'
,
''
),
});
});
it
(
'
starts with only JsHooks
'
,
()
=>
{
it
(
'
starts with only JsHooks
'
,
()
=>
{
...
...
spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js
View file @
dff561fa
...
@@ -15,10 +15,10 @@ import eventHub from '~/vue_merge_request_widget/event_hub';
...
@@ -15,10 +15,10 @@ import eventHub from '~/vue_merge_request_widget/event_hub';
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
const
TEST_HELP_PATH
=
'
help/path
'
;
const
TEST_HELP_PATH
=
'
help/path
'
;
const
testApprovedBy
=
()
=>
[
1
,
7
,
10
].
map
(
id
=>
({
id
}));
const
testApprovedBy
=
()
=>
[
1
,
7
,
10
].
map
(
(
id
)
=>
({
id
}));
const
testApprovals
=
()
=>
({
const
testApprovals
=
()
=>
({
approved
:
false
,
approved
:
false
,
approved_by
:
testApprovedBy
().
map
(
user
=>
({
user
})),
approved_by
:
testApprovedBy
().
map
(
(
user
)
=>
({
user
})),
approval_rules_left
:
[],
approval_rules_left
:
[],
approvals_left
:
4
,
approvals_left
:
4
,
suggested_approvers
:
[],
suggested_approvers
:
[],
...
@@ -31,7 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] });
...
@@ -31,7 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] });
// For some reason, the `Promise.resolve()` needs to be deferred
// For some reason, the `Promise.resolve()` needs to be deferred
// or the timing doesn't work.
// or the timing doesn't work.
const
tick
=
()
=>
Promise
.
resolve
();
const
tick
=
()
=>
Promise
.
resolve
();
const
waitForTick
=
done
=>
tick
().
then
(
done
).
catch
(
done
.
fail
);
const
waitForTick
=
(
done
)
=>
tick
().
then
(
done
).
catch
(
done
.
fail
);
describe
(
'
MRWidget approvals
'
,
()
=>
{
describe
(
'
MRWidget approvals
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -114,7 +114,7 @@ describe('MRWidget approvals', () => {
...
@@ -114,7 +114,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
when fetch approvals error
'
,
()
=>
{
describe
(
'
when fetch approvals error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
fetchApprovals
'
).
mockReturnValue
(
Promise
.
reject
());
jest
.
spyOn
(
service
,
'
fetchApprovals
'
).
mockReturnValue
(
Promise
.
reject
());
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
...
@@ -131,7 +131,7 @@ describe('MRWidget approvals', () => {
...
@@ -131,7 +131,7 @@ describe('MRWidget approvals', () => {
describe
(
'
action button
'
,
()
=>
{
describe
(
'
action button
'
,
()
=>
{
describe
(
'
when mr is closed
'
,
()
=>
{
describe
(
'
when mr is closed
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
isOpen
=
false
;
mr
.
isOpen
=
false
;
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_can_approve
=
true
;
mr
.
approvals
.
user_can_approve
=
true
;
...
@@ -146,7 +146,7 @@ describe('MRWidget approvals', () => {
...
@@ -146,7 +146,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
when user cannot approve
'
,
()
=>
{
describe
(
'
when user cannot approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_can_approve
=
false
;
mr
.
approvals
.
user_can_approve
=
false
;
...
@@ -166,7 +166,7 @@ describe('MRWidget approvals', () => {
...
@@ -166,7 +166,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and MR is unapproved
'
,
()
=>
{
describe
(
'
and MR is unapproved
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
});
});
...
@@ -186,7 +186,7 @@ describe('MRWidget approvals', () => {
...
@@ -186,7 +186,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
with no approvers
'
,
()
=>
{
describe
(
'
with no approvers
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
approved_by
=
[];
mr
.
approvals
.
approved_by
=
[];
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
...
@@ -202,7 +202,7 @@ describe('MRWidget approvals', () => {
...
@@ -202,7 +202,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
with approvers
'
,
()
=>
{
describe
(
'
with approvers
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
approved_by
=
[{
user
:
{
id
:
7
}
}];
mr
.
approvals
.
approved_by
=
[{
user
:
{
id
:
7
}
}];
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
...
@@ -219,7 +219,7 @@ describe('MRWidget approvals', () => {
...
@@ -219,7 +219,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
when approve action is clicked
'
,
()
=>
{
describe
(
'
when approve action is clicked
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
});
});
...
@@ -238,7 +238,7 @@ describe('MRWidget approvals', () => {
...
@@ -238,7 +238,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and after loading
'
,
()
=>
{
describe
(
'
and after loading
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
findAction
().
vm
.
$emit
(
'
click
'
);
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
waitForTick
(
done
);
});
});
...
@@ -257,7 +257,7 @@ describe('MRWidget approvals', () => {
...
@@ -257,7 +257,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and error
'
,
()
=>
{
describe
(
'
and error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
approveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
jest
.
spyOn
(
service
,
'
approveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
findAction
().
vm
.
$emit
(
'
click
'
);
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
waitForTick
(
done
);
...
@@ -271,7 +271,7 @@ describe('MRWidget approvals', () => {
...
@@ -271,7 +271,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
when user has approved
'
,
()
=>
{
describe
(
'
when user has approved
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_has_approved
=
true
;
mr
.
approvals
.
user_has_approved
=
true
;
mr
.
approvals
.
user_can_approve
=
false
;
mr
.
approvals
.
user_can_approve
=
false
;
...
@@ -289,7 +289,7 @@ describe('MRWidget approvals', () => {
...
@@ -289,7 +289,7 @@ describe('MRWidget approvals', () => {
describe
(
'
when revoke action is clicked
'
,
()
=>
{
describe
(
'
when revoke action is clicked
'
,
()
=>
{
describe
(
'
and successful
'
,
()
=>
{
describe
(
'
and successful
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
findAction
().
vm
.
$emit
(
'
click
'
);
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
waitForTick
(
done
);
});
});
...
@@ -308,7 +308,7 @@ describe('MRWidget approvals', () => {
...
@@ -308,7 +308,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and error
'
,
()
=>
{
describe
(
'
and error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
unapproveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
jest
.
spyOn
(
service
,
'
unapproveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
findAction
().
vm
.
$emit
(
'
click
'
);
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
waitForTick
(
done
);
...
@@ -331,7 +331,7 @@ describe('MRWidget approvals', () => {
...
@@ -331,7 +331,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and can approve
'
,
()
=>
{
describe
(
'
and can approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_can_approve
=
true
;
mr
.
approvals
.
user_can_approve
=
true
;
createComponent
();
createComponent
();
...
@@ -348,7 +348,7 @@ describe('MRWidget approvals', () => {
...
@@ -348,7 +348,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
and cannot approve
'
,
()
=>
{
describe
(
'
and cannot approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_can_approve
=
false
;
mr
.
approvals
.
user_can_approve
=
false
;
createComponent
();
createComponent
();
...
@@ -367,7 +367,7 @@ describe('MRWidget approvals', () => {
...
@@ -367,7 +367,7 @@ describe('MRWidget approvals', () => {
});
});
describe
(
'
approvals summary
'
,
()
=>
{
describe
(
'
approvals summary
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
createComponent
();
waitForTick
(
done
);
waitForTick
(
done
);
});
});
...
...
spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js
View file @
dff561fa
...
@@ -4,7 +4,7 @@ import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/ap
...
@@ -4,7 +4,7 @@ import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/ap
import
{
toNounSeriesText
}
from
'
~/lib/utils/grammar
'
;
import
{
toNounSeriesText
}
from
'
~/lib/utils/grammar
'
;
import
UserAvatarList
from
'
~/vue_shared/components/user_avatar/user_avatar_list.vue
'
;
import
UserAvatarList
from
'
~/vue_shared/components/user_avatar/user_avatar_list.vue
'
;
const
testApprovers
=
()
=>
Array
.
from
({
length
:
5
},
(
_
,
i
)
=>
i
).
map
(
id
=>
({
id
}));
const
testApprovers
=
()
=>
Array
.
from
({
length
:
5
},
(
_
,
i
)
=>
i
).
map
(
(
id
)
=>
({
id
}));
const
testRulesLeft
=
()
=>
[
'
Lorem
'
,
'
Ipsum
'
,
'
dolar & sit
'
];
const
testRulesLeft
=
()
=>
[
'
Lorem
'
,
'
Ipsum
'
,
'
dolar & sit
'
];
const
TEST_APPROVALS_LEFT
=
3
;
const
TEST_APPROVALS_LEFT
=
3
;
...
...
spec/frontend/vue_mr_widget/components/artifacts_list_spec.js
View file @
dff561fa
...
@@ -10,7 +10,7 @@ describe('Artifacts List', () => {
...
@@ -10,7 +10,7 @@ describe('Artifacts List', () => {
artifacts
:
artifactsList
,
artifacts
:
artifactsList
,
};
};
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
ArtifactsList
,
{
wrapper
=
shallowMount
(
ArtifactsList
,
{
propsData
:
{
propsData
:
{
...
props
,
...
props
,
...
...
spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
View file @
dff561fa
...
@@ -8,7 +8,7 @@ describe('Merge Request Collapsible Extension', () => {
...
@@ -8,7 +8,7 @@ describe('Merge Request Collapsible Extension', () => {
title
:
'
View artifacts
'
,
title
:
'
View artifacts
'
,
};
};
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
wrapper
=
mount
(
MrCollapsibleSection
,
{
wrapper
=
mount
(
MrCollapsibleSection
,
{
propsData
:
{
propsData
:
{
...
props
,
...
props
,
...
...
spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js
View file @
dff561fa
...
@@ -19,7 +19,7 @@ describe('MrWidgetAlertMessage', () => {
...
@@ -19,7 +19,7 @@ describe('MrWidgetAlertMessage', () => {
});
});
describe
(
'
when type is not provided
'
,
()
=>
{
describe
(
'
when type is not provided
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
expect
(
wrapper
.
classes
()).
not
.
toContain
(
'
warning_message
'
);
expect
(
wrapper
.
classes
()).
not
.
toContain
(
'
warning_message
'
);
...
@@ -29,7 +29,7 @@ describe('MrWidgetAlertMessage', () => {
...
@@ -29,7 +29,7 @@ describe('MrWidgetAlertMessage', () => {
});
});
describe
(
'
when type === "danger"
'
,
()
=>
{
describe
(
'
when type === "danger"
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
setProps
({
type
:
'
danger
'
});
wrapper
.
setProps
({
type
:
'
danger
'
});
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
...
@@ -40,7 +40,7 @@ describe('MrWidgetAlertMessage', () => {
...
@@ -40,7 +40,7 @@ describe('MrWidgetAlertMessage', () => {
});
});
describe
(
'
when type === "warning"
'
,
()
=>
{
describe
(
'
when type === "warning"
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
setProps
({
type
:
'
warning
'
});
wrapper
.
setProps
({
type
:
'
warning
'
});
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
warning_message
'
);
expect
(
wrapper
.
classes
()).
toContain
(
'
warning_message
'
);
...
@@ -51,7 +51,7 @@ describe('MrWidgetAlertMessage', () => {
...
@@ -51,7 +51,7 @@ describe('MrWidgetAlertMessage', () => {
});
});
describe
(
'
when helpPath is not provided
'
,
()
=>
{
describe
(
'
when helpPath is not provided
'
,
()
=>
{
it
(
'
should not render a help icon/link
'
,
done
=>
{
it
(
'
should not render a help icon/link
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
const
link
=
wrapper
.
find
(
GlLink
);
const
link
=
wrapper
.
find
(
GlLink
);
...
@@ -62,7 +62,7 @@ describe('MrWidgetAlertMessage', () => {
...
@@ -62,7 +62,7 @@ describe('MrWidgetAlertMessage', () => {
});
});
describe
(
'
when helpPath is provided
'
,
()
=>
{
describe
(
'
when helpPath is provided
'
,
()
=>
{
it
(
'
should render a help icon/link
'
,
done
=>
{
it
(
'
should render a help icon/link
'
,
(
done
)
=>
{
wrapper
.
setProps
({
helpPath
:
'
/path/to/help/docs
'
});
wrapper
.
setProps
({
helpPath
:
'
/path/to/help/docs
'
});
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
const
link
=
wrapper
.
find
(
GlLink
);
const
link
=
wrapper
.
find
(
GlLink
);
...
...
spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
View file @
dff561fa
...
@@ -187,7 +187,7 @@ describe('MRWidgetHeader', () => {
...
@@ -187,7 +187,7 @@ describe('MRWidgetHeader', () => {
expect
(
link
.
getAttribute
(
'
href
'
)).
toBeNull
();
expect
(
link
.
getAttribute
(
'
href
'
)).
toBeNull
();
});
});
it
(
'
renders web ide button with blank query string if target & source project branch
'
,
done
=>
{
it
(
'
renders web ide button with blank query string if target & source project branch
'
,
(
done
)
=>
{
vm
.
mr
.
targetProjectFullPath
=
'
root/gitlab-ce
'
;
vm
.
mr
.
targetProjectFullPath
=
'
root/gitlab-ce
'
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
...
@@ -202,7 +202,7 @@ describe('MRWidgetHeader', () => {
...
@@ -202,7 +202,7 @@ describe('MRWidgetHeader', () => {
});
});
});
});
it
(
'
renders web ide button with relative URL
'
,
done
=>
{
it
(
'
renders web ide button with relative URL
'
,
(
done
)
=>
{
gon
.
relative_url_root
=
'
/gitlab
'
;
gon
.
relative_url_root
=
'
/gitlab
'
;
vm
.
mr
.
iid
=
2
;
vm
.
mr
.
iid
=
2
;
...
...
spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js
View file @
dff561fa
...
@@ -153,13 +153,13 @@ describe('MemoryUsage', () => {
...
@@ -153,13 +153,13 @@ describe('MemoryUsage', () => {
describe
(
'
loadMetrics
'
,
()
=>
{
describe
(
'
loadMetrics
'
,
()
=>
{
const
returnServicePromise
=
()
=>
const
returnServicePromise
=
()
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
metricsMockData
,
data
:
metricsMockData
,
});
});
});
});
it
(
'
should load metrics data using MRWidgetService
'
,
done
=>
{
it
(
'
should load metrics data using MRWidgetService
'
,
(
done
)
=>
{
jest
.
spyOn
(
MRWidgetService
,
'
fetchMetrics
'
).
mockReturnValue
(
returnServicePromise
(
true
));
jest
.
spyOn
(
MRWidgetService
,
'
fetchMetrics
'
).
mockReturnValue
(
returnServicePromise
(
true
));
jest
.
spyOn
(
vm
,
'
computeGraphData
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
computeGraphData
'
).
mockImplementation
(()
=>
{});
...
@@ -179,7 +179,7 @@ describe('MemoryUsage', () => {
...
@@ -179,7 +179,7 @@ describe('MemoryUsage', () => {
expect
(
el
.
querySelector
(
'
.js-usage-info
'
)).
toBeDefined
();
expect
(
el
.
querySelector
(
'
.js-usage-info
'
)).
toBeDefined
();
});
});
it
(
'
should show loading metrics message while metrics are being loaded
'
,
done
=>
{
it
(
'
should show loading metrics message while metrics are being loaded
'
,
(
done
)
=>
{
vm
.
loadingMetrics
=
true
;
vm
.
loadingMetrics
=
true
;
vm
.
hasMetrics
=
false
;
vm
.
hasMetrics
=
false
;
vm
.
loadFailed
=
false
;
vm
.
loadFailed
=
false
;
...
@@ -194,7 +194,7 @@ describe('MemoryUsage', () => {
...
@@ -194,7 +194,7 @@ describe('MemoryUsage', () => {
});
});
});
});
it
(
'
should show deployment memory usage when metrics are loaded
'
,
done
=>
{
it
(
'
should show deployment memory usage when metrics are loaded
'
,
(
done
)
=>
{
// ignore BoostrapVue warnings
// ignore BoostrapVue warnings
jest
.
spyOn
(
console
,
'
warn
'
).
mockImplementation
();
jest
.
spyOn
(
console
,
'
warn
'
).
mockImplementation
();
...
@@ -210,7 +210,7 @@ describe('MemoryUsage', () => {
...
@@ -210,7 +210,7 @@ describe('MemoryUsage', () => {
});
});
});
});
it
(
'
should show failure message when metrics loading failed
'
,
done
=>
{
it
(
'
should show failure message when metrics loading failed
'
,
(
done
)
=>
{
vm
.
loadingMetrics
=
false
;
vm
.
loadingMetrics
=
false
;
vm
.
hasMetrics
=
false
;
vm
.
hasMetrics
=
false
;
vm
.
loadFailed
=
true
;
vm
.
loadFailed
=
true
;
...
@@ -223,7 +223,7 @@ describe('MemoryUsage', () => {
...
@@ -223,7 +223,7 @@ describe('MemoryUsage', () => {
});
});
});
});
it
(
'
should show metrics unavailable message when metrics loading failed
'
,
done
=>
{
it
(
'
should show metrics unavailable message when metrics loading failed
'
,
(
done
)
=>
{
vm
.
loadingMetrics
=
false
;
vm
.
loadingMetrics
=
false
;
vm
.
hasMetrics
=
false
;
vm
.
hasMetrics
=
false
;
vm
.
loadFailed
=
false
;
vm
.
loadFailed
=
false
;
...
...
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
View file @
dff561fa
...
@@ -46,7 +46,7 @@ describe('MrWidgetPipelineContainer', () => {
...
@@ -46,7 +46,7 @@ describe('MrWidgetPipelineContainer', () => {
});
});
it
(
'
renders deployments
'
,
()
=>
{
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
deployments
.
map
(
dep
=>
const
expectedProps
=
mockStore
.
deployments
.
map
(
(
dep
)
=>
expect
.
objectContaining
({
expect
.
objectContaining
({
deployment
:
dep
,
deployment
:
dep
,
showMetrics
:
false
,
showMetrics
:
false
,
...
@@ -55,7 +55,7 @@ describe('MrWidgetPipelineContainer', () => {
...
@@ -55,7 +55,7 @@ describe('MrWidgetPipelineContainer', () => {
const
deployments
=
wrapper
.
findAll
(
'
.mr-widget-extension .js-pre-deployment
'
);
const
deployments
=
wrapper
.
findAll
(
'
.mr-widget-extension .js-pre-deployment
'
);
expect
(
deployments
.
wrappers
.
map
(
x
=>
x
.
props
())).
toEqual
(
expectedProps
);
expect
(
deployments
.
wrappers
.
map
(
(
x
)
=>
x
.
props
())).
toEqual
(
expectedProps
);
});
});
});
});
...
@@ -79,7 +79,7 @@ describe('MrWidgetPipelineContainer', () => {
...
@@ -79,7 +79,7 @@ describe('MrWidgetPipelineContainer', () => {
});
});
it
(
'
renders deployments
'
,
()
=>
{
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
(
dep
=>
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
(
(
dep
)
=>
expect
.
objectContaining
({
expect
.
objectContaining
({
deployment
:
dep
,
deployment
:
dep
,
showMetrics
:
true
,
showMetrics
:
true
,
...
@@ -88,7 +88,7 @@ describe('MrWidgetPipelineContainer', () => {
...
@@ -88,7 +88,7 @@ describe('MrWidgetPipelineContainer', () => {
const
deployments
=
wrapper
.
findAll
(
'
.mr-widget-extension .js-post-deployment
'
);
const
deployments
=
wrapper
.
findAll
(
'
.mr-widget-extension .js-post-deployment
'
);
expect
(
deployments
.
wrappers
.
map
(
x
=>
x
.
props
())).
toEqual
(
expectedProps
);
expect
(
deployments
.
wrappers
.
map
(
(
x
)
=>
x
.
props
())).
toEqual
(
expectedProps
);
});
});
});
});
...
...
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
View file @
dff561fa
...
@@ -122,7 +122,7 @@ describe('MRWidgetPipeline', () => {
...
@@ -122,7 +122,7 @@ describe('MRWidgetPipeline', () => {
it
.
each
(
mockData
.
buildsWithCoverage
)(
it
.
each
(
mockData
.
buildsWithCoverage
)(
'
should have name and coverage for build %s listed in tooltip
'
,
'
should have name and coverage for build %s listed in tooltip
'
,
build
=>
{
(
build
)
=>
{
const
tooltipText
=
findPipelineCoverageTooltipText
();
const
tooltipText
=
findPipelineCoverageTooltipText
();
expect
(
tooltipText
).
toContain
(
`
${
build
.
name
}
(
${
build
.
coverage
}
%)`
);
expect
(
tooltipText
).
toContain
(
`
${
build
.
name
}
(
${
build
.
coverage
}
%)`
);
...
...
spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js
View file @
dff561fa
...
@@ -49,7 +49,7 @@ describe('Merge request widget rebase component', () => {
...
@@ -49,7 +49,7 @@ describe('Merge request widget rebase component', () => {
);
);
});
});
it
(
'
it should render error message when it fails
'
,
done
=>
{
it
(
'
it should render error message when it fails
'
,
(
done
)
=>
{
vm
.
rebasingError
=
'
Something went wrong!
'
;
vm
.
rebasingError
=
'
Something went wrong!
'
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -98,7 +98,7 @@ describe('Merge request widget rebase component', () => {
...
@@ -98,7 +98,7 @@ describe('Merge request widget rebase component', () => {
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
it
(
'
checkRebaseStatus
'
,
done
=>
{
it
(
'
checkRebaseStatus
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
vm
=
mountComponent
(
Component
,
{
vm
=
mountComponent
(
Component
,
{
mr
:
{},
mr
:
{},
...
...
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
View file @
dff561fa
...
@@ -5,7 +5,7 @@ import relatedLinksComponent from '~/vue_merge_request_widget/components/mr_widg
...
@@ -5,7 +5,7 @@ import relatedLinksComponent from '~/vue_merge_request_widget/components/mr_widg
describe
(
'
MRWidgetRelatedLinks
'
,
()
=>
{
describe
(
'
MRWidgetRelatedLinks
'
,
()
=>
{
let
vm
;
let
vm
;
const
createComponent
=
data
=>
{
const
createComponent
=
(
data
)
=>
{
const
Component
=
Vue
.
extend
(
relatedLinksComponent
);
const
Component
=
Vue
.
extend
(
relatedLinksComponent
);
return
mountComponent
(
Component
,
data
);
return
mountComponent
(
Component
,
data
);
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
View file @
dff561fa
...
@@ -108,12 +108,12 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -108,12 +108,12 @@ describe('MRWidgetAutoMergeEnabled', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
cancelAutomaticMerge
'
,
()
=>
{
describe
(
'
cancelAutomaticMerge
'
,
()
=>
{
it
(
'
should set flag and call service then tell main component to update the widget with data
'
,
done
=>
{
it
(
'
should set flag and call service then tell main component to update the widget with data
'
,
(
done
)
=>
{
const
mrObj
=
{
const
mrObj
=
{
is_new_mr_data
:
true
,
is_new_mr_data
:
true
,
};
};
jest
.
spyOn
(
vm
.
service
,
'
cancelAutomaticMerge
'
).
mockReturnValue
(
jest
.
spyOn
(
vm
.
service
,
'
cancelAutomaticMerge
'
).
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
mrObj
,
data
:
mrObj
,
});
});
...
@@ -130,7 +130,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -130,7 +130,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
describe
(
'
removeSourceBranch
'
,
()
=>
{
describe
(
'
removeSourceBranch
'
,
()
=>
{
it
(
'
should set flag and call service then request main component to update the widget
'
,
done
=>
{
it
(
'
should set flag and call service then request main component to update the widget
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
Promise
.
resolve
({
Promise
.
resolve
({
data
:
{
data
:
{
...
@@ -173,7 +173,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -173,7 +173,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.js-remove-source-branch
'
).
getAttribute
(
'
disabled
'
)).
toBeFalsy
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-remove-source-branch
'
).
getAttribute
(
'
disabled
'
)).
toBeFalsy
();
});
});
it
(
'
should disable cancel auto merge button when the action is in progress
'
,
done
=>
{
it
(
'
should disable cancel auto merge button when the action is in progress
'
,
(
done
)
=>
{
vm
.
isCancellingAutoMerge
=
true
;
vm
.
isCancellingAutoMerge
=
true
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -182,7 +182,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -182,7 +182,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
});
});
it
(
'
should show source branch will be deleted text when it source branch set to remove
'
,
done
=>
{
it
(
'
should show source branch will be deleted text when it source branch set to remove
'
,
(
done
)
=>
{
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -194,7 +194,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -194,7 +194,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
});
});
it
(
'
should not show delete source branch button when user not able to delete source branch
'
,
done
=>
{
it
(
'
should not show delete source branch button when user not able to delete source branch
'
,
(
done
)
=>
{
vm
.
mr
.
currentUserId
=
4
;
vm
.
mr
.
currentUserId
=
4
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -203,7 +203,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -203,7 +203,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
});
});
it
(
'
should disable delete source branch button when the action is in progress
'
,
done
=>
{
it
(
'
should disable delete source branch button when the action is in progress
'
,
(
done
)
=>
{
vm
.
isRemovingSourceBranch
=
true
;
vm
.
isRemovingSourceBranch
=
true
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -214,7 +214,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -214,7 +214,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
});
});
it
(
'
should render the status text as "...to merged automatically" if MWPS is selected
'
,
done
=>
{
it
(
'
should render the status text as "...to merged automatically" if MWPS is selected
'
,
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
autoMergeStrategy
'
,
MWPS_MERGE_STRATEGY
);
Vue
.
set
(
vm
.
mr
,
'
autoMergeStrategy
'
,
MWPS_MERGE_STRATEGY
);
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -225,7 +225,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -225,7 +225,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
});
});
it
(
'
should render the cancel button as "Cancel automatic merge" if MWPS is selected
'
,
done
=>
{
it
(
'
should render the cancel button as "Cancel automatic merge" if MWPS is selected
'
,
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
autoMergeStrategy
'
,
MWPS_MERGE_STRATEGY
);
Vue
.
set
(
vm
.
mr
,
'
autoMergeStrategy
'
,
MWPS_MERGE_STRATEGY
);
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js
View file @
dff561fa
...
@@ -4,7 +4,7 @@ import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_
...
@@ -4,7 +4,7 @@ import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_
describe
(
'
Commits header component
'
,
()
=>
{
describe
(
'
Commits header component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
CommitsHeader
,
{
wrapper
=
shallowMount
(
CommitsHeader
,
{
propsData
:
{
propsData
:
{
isSquashEnabled
:
false
,
isSquashEnabled
:
false
,
...
@@ -110,21 +110,21 @@ describe('Commits header component', () => {
...
@@ -110,21 +110,21 @@ describe('Commits header component', () => {
wrapper
.
setData
({
expanded
:
true
});
wrapper
.
setData
({
expanded
:
true
});
});
});
it
(
'
toggle has aria-label equal to collapse
'
,
done
=>
{
it
(
'
toggle has aria-label equal to collapse
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
findCommitToggle
().
attributes
(
'
aria-label
'
)).
toBe
(
'
Collapse
'
);
expect
(
findCommitToggle
().
attributes
(
'
aria-label
'
)).
toBe
(
'
Collapse
'
);
done
();
done
();
});
});
});
});
it
(
'
has a chevron-down icon
'
,
done
=>
{
it
(
'
has a chevron-down icon
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
findCommitToggle
().
props
(
'
icon
'
)).
toBe
(
'
chevron-down
'
);
expect
(
findCommitToggle
().
props
(
'
icon
'
)).
toBe
(
'
chevron-down
'
);
done
();
done
();
});
});
});
});
it
(
'
has a collapse text
'
,
done
=>
{
it
(
'
has a collapse text
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
findHeaderWrapper
().
text
()).
toBe
(
'
Collapse
'
);
expect
(
findHeaderWrapper
().
text
()).
toBe
(
'
Collapse
'
);
done
();
done
();
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
dff561fa
...
@@ -54,7 +54,7 @@ describe('MRWidgetConflicts', () => {
...
@@ -54,7 +54,7 @@ describe('MRWidgetConflicts', () => {
vm
.
destroy
();
vm
.
destroy
();
});
});
[
false
,
true
].
forEach
(
featureEnabled
=>
{
[
false
,
true
].
forEach
(
(
featureEnabled
)
=>
{
describe
(
`with GraphQL feature flag
${
featureEnabled
?
'
enabled
'
:
'
disabled
'
}
`
,
()
=>
{
describe
(
`with GraphQL feature flag
${
featureEnabled
?
'
enabled
'
:
'
disabled
'
}
`
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mergeRequestWidgetGraphql
=
featureEnabled
;
mergeRequestWidgetGraphql
=
featureEnabled
;
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
View file @
dff561fa
...
@@ -49,7 +49,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -49,7 +49,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
describe
(
'
mergeError
'
,
()
=>
{
describe
(
'
mergeError
'
,
()
=>
{
it
(
'
removes forced line breaks
'
,
done
=>
{
it
(
'
removes forced line breaks
'
,
(
done
)
=>
{
mr
.
mergeError
=
'
contains<br />line breaks<br />
'
;
mr
.
mergeError
=
'
contains<br />line breaks<br />
'
;
Vue
.
nextTick
()
Vue
.
nextTick
()
...
@@ -98,7 +98,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -98,7 +98,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
describe
(
'
while it is refreshing
'
,
()
=>
{
describe
(
'
while it is refreshing
'
,
()
=>
{
it
(
'
renders Refresing now
'
,
done
=>
{
it
(
'
renders Refresing now
'
,
(
done
)
=>
{
vm
.
isRefreshing
=
true
;
vm
.
isRefreshing
=
true
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -139,7 +139,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -139,7 +139,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
});
});
it
(
'
should just generic merge failed message if merge_error is not available
'
,
done
=>
{
it
(
'
should just generic merge failed message if merge_error is not available
'
,
(
done
)
=>
{
vm
.
mr
.
mergeError
=
null
;
vm
.
mr
.
mergeError
=
null
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -149,7 +149,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -149,7 +149,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
});
});
it
(
'
should show refresh label when refresh requested
'
,
done
=>
{
it
(
'
should show refresh label when refresh requested
'
,
(
done
)
=>
{
vm
.
refresh
();
vm
.
refresh
();
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
innerText
).
not
.
toContain
(
'
Merge failed. Refreshing
'
);
expect
(
vm
.
$el
.
innerText
).
not
.
toContain
(
'
Merge failed. Refreshing
'
);
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js
View file @
dff561fa
...
@@ -123,9 +123,9 @@ describe('MRWidgetMerged', () => {
...
@@ -123,9 +123,9 @@ describe('MRWidgetMerged', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
removeSourceBranch
'
,
()
=>
{
describe
(
'
removeSourceBranch
'
,
()
=>
{
it
(
'
should set flag and call service then request main component to update the widget
'
,
done
=>
{
it
(
'
should set flag and call service then request main component to update the widget
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
removeSourceBranch
'
).
mockReturnValue
(
jest
.
spyOn
(
vm
.
service
,
'
removeSourceBranch
'
).
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
{
data
:
{
message
:
'
Branch was deleted
'
,
message
:
'
Branch was deleted
'
,
...
@@ -173,7 +173,7 @@ describe('MRWidgetMerged', () => {
...
@@ -173,7 +173,7 @@ describe('MRWidgetMerged', () => {
);
);
});
});
it
(
'
hides button to copy commit SHA if SHA does not exist
'
,
done
=>
{
it
(
'
hides button to copy commit SHA if SHA does not exist
'
,
(
done
)
=>
{
vm
.
mr
.
mergeCommitSha
=
null
;
vm
.
mr
.
mergeCommitSha
=
null
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -189,7 +189,7 @@ describe('MRWidgetMerged', () => {
...
@@ -189,7 +189,7 @@ describe('MRWidgetMerged', () => {
expect
(
selectors
.
mergeCommitShaLink
.
href
).
toBe
(
vm
.
mr
.
mergeCommitPath
);
expect
(
selectors
.
mergeCommitShaLink
.
href
).
toBe
(
vm
.
mr
.
mergeCommitPath
);
});
});
it
(
'
should not show source branch deleted text
'
,
done
=>
{
it
(
'
should not show source branch deleted text
'
,
(
done
)
=>
{
vm
.
mr
.
sourceBranchRemoved
=
false
;
vm
.
mr
.
sourceBranchRemoved
=
false
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
@@ -199,7 +199,7 @@ describe('MRWidgetMerged', () => {
...
@@ -199,7 +199,7 @@ describe('MRWidgetMerged', () => {
});
});
});
});
it
(
'
should show source branch deleting text
'
,
done
=>
{
it
(
'
should show source branch deleting text
'
,
(
done
)
=>
{
vm
.
mr
.
isRemovingSourceBranch
=
true
;
vm
.
mr
.
isRemovingSourceBranch
=
true
;
vm
.
mr
.
sourceBranchRemoved
=
false
;
vm
.
mr
.
sourceBranchRemoved
=
false
;
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
View file @
dff561fa
...
@@ -25,7 +25,7 @@ describe('MRWidgetMissingBranch', () => {
...
@@ -25,7 +25,7 @@ describe('MRWidgetMissingBranch', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
[
true
,
false
].
forEach
(
mergeRequestWidgetGraphql
=>
{
[
true
,
false
].
forEach
(
(
mergeRequestWidgetGraphql
)
=>
{
describe
(
`widget GraphQL feature flag is
${
describe
(
`widget GraphQL feature flag is
${
mergeRequestWidgetGraphql
?
'
enabled
'
:
'
disabled
'
mergeRequestWidgetGraphql
?
'
enabled
'
:
'
disabled
'
}
`
,
()
=>
{
}
`
,
()
=>
{
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
dff561fa
...
@@ -20,7 +20,7 @@ jest.mock('~/commons/nav/user_merge_requests', () => ({
...
@@ -20,7 +20,7 @@ jest.mock('~/commons/nav/user_merge_requests', () => ({
const
commitMessage
=
'
This is the commit message
'
;
const
commitMessage
=
'
This is the commit message
'
;
const
squashCommitMessage
=
'
This is the squash commit message
'
;
const
squashCommitMessage
=
'
This is the squash commit message
'
;
const
commitMessageWithDescription
=
'
This is the commit message description
'
;
const
commitMessageWithDescription
=
'
This is the commit message description
'
;
const
createTestMr
=
customConfig
=>
{
const
createTestMr
=
(
customConfig
)
=>
{
const
mr
=
{
const
mr
=
{
isPipelineActive
:
false
,
isPipelineActive
:
false
,
pipeline
:
null
,
pipeline
:
null
,
...
@@ -346,8 +346,8 @@ describe('ReadyToMerge', () => {
...
@@ -346,8 +346,8 @@ describe('ReadyToMerge', () => {
});
});
describe
(
'
handleMergeButtonClick
'
,
()
=>
{
describe
(
'
handleMergeButtonClick
'
,
()
=>
{
const
returnPromise
=
status
=>
const
returnPromise
=
(
status
)
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
{
data
:
{
status
,
status
,
...
@@ -355,7 +355,7 @@ describe('ReadyToMerge', () => {
...
@@ -355,7 +355,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should handle merge when pipeline succeeds
'
,
done
=>
{
it
(
'
should handle merge when pipeline succeeds
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
jest
.
spyOn
(
vm
.
service
,
'
merge
'
)
.
spyOn
(
vm
.
service
,
'
merge
'
)
...
@@ -381,7 +381,7 @@ describe('ReadyToMerge', () => {
...
@@ -381,7 +381,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should handle merge failed
'
,
done
=>
{
it
(
'
should handle merge failed
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
returnPromise
(
'
failed
'
));
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
returnPromise
(
'
failed
'
));
vm
.
handleMergeButtonClick
(
false
,
true
);
vm
.
handleMergeButtonClick
(
false
,
true
);
...
@@ -398,7 +398,7 @@ describe('ReadyToMerge', () => {
...
@@ -398,7 +398,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should handle merge action accepted case
'
,
done
=>
{
it
(
'
should handle merge action accepted case
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
returnPromise
(
'
success
'
));
jest
.
spyOn
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
returnPromise
(
'
success
'
));
jest
.
spyOn
(
vm
,
'
initiateMergePolling
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
initiateMergePolling
'
).
mockImplementation
(()
=>
{});
vm
.
handleMergeButtonClick
();
vm
.
handleMergeButtonClick
();
...
@@ -433,8 +433,8 @@ describe('ReadyToMerge', () => {
...
@@ -433,8 +433,8 @@ describe('ReadyToMerge', () => {
});
});
describe
(
'
handleMergePolling
'
,
()
=>
{
describe
(
'
handleMergePolling
'
,
()
=>
{
const
returnPromise
=
state
=>
const
returnPromise
=
(
state
)
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
{
data
:
{
state
,
state
,
...
@@ -447,7 +447,7 @@ describe('ReadyToMerge', () => {
...
@@ -447,7 +447,7 @@ describe('ReadyToMerge', () => {
loadFixtures
(
'
merge_requests/merge_request_of_current_user.html
'
);
loadFixtures
(
'
merge_requests/merge_request_of_current_user.html
'
);
});
});
it
(
'
should call start and stop polling when MR merged
'
,
done
=>
{
it
(
'
should call start and stop polling when MR merged
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
@@ -476,7 +476,7 @@ describe('ReadyToMerge', () => {
...
@@ -476,7 +476,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
updates status box
'
,
done
=>
{
it
(
'
updates status box
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
@@ -495,7 +495,7 @@ describe('ReadyToMerge', () => {
...
@@ -495,7 +495,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
updates merge request count badge
'
,
done
=>
{
it
(
'
updates merge request count badge
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
@@ -511,7 +511,7 @@ describe('ReadyToMerge', () => {
...
@@ -511,7 +511,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should continue polling until MR is merged
'
,
done
=>
{
it
(
'
should continue polling until MR is merged
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
some_other_state
'
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
some_other_state
'
));
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
@@ -547,8 +547,8 @@ describe('ReadyToMerge', () => {
...
@@ -547,8 +547,8 @@ describe('ReadyToMerge', () => {
});
});
describe
(
'
handleRemoveBranchPolling
'
,
()
=>
{
describe
(
'
handleRemoveBranchPolling
'
,
()
=>
{
const
returnPromise
=
state
=>
const
returnPromise
=
(
state
)
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
{
data
:
{
source_branch_exists
:
state
,
source_branch_exists
:
state
,
...
@@ -556,7 +556,7 @@ describe('ReadyToMerge', () => {
...
@@ -556,7 +556,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should call start and stop polling when MR merged
'
,
done
=>
{
it
(
'
should call start and stop polling when MR merged
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
false
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
false
));
...
@@ -589,7 +589,7 @@ describe('ReadyToMerge', () => {
...
@@ -589,7 +589,7 @@ describe('ReadyToMerge', () => {
});
});
});
});
it
(
'
should continue polling until MR is merged
'
,
done
=>
{
it
(
'
should continue polling until MR is merged
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
true
));
jest
.
spyOn
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
true
));
let
cpc
=
false
;
// continuePollingCalled
let
cpc
=
false
;
// continuePollingCalled
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
View file @
dff561fa
...
@@ -8,7 +8,7 @@ const localVue = createLocalVue();
...
@@ -8,7 +8,7 @@ const localVue = createLocalVue();
describe
(
'
Squash before merge component
'
,
()
=>
{
describe
(
'
Squash before merge component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
localVue
.
extend
(
SquashBeforeMerge
),
{
wrapper
=
shallowMount
(
localVue
.
extend
(
SquashBeforeMerge
),
{
localVue
,
localVue
,
propsData
:
{
propsData
:
{
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js
View file @
dff561fa
...
@@ -47,12 +47,12 @@ describe('Wip', () => {
...
@@ -47,12 +47,12 @@ describe('Wip', () => {
};
};
describe
(
'
handleRemoveWIP
'
,
()
=>
{
describe
(
'
handleRemoveWIP
'
,
()
=>
{
it
(
'
should make a request to service and handle response
'
,
done
=>
{
it
(
'
should make a request to service and handle response
'
,
(
done
)
=>
{
const
vm
=
createComponent
();
const
vm
=
createComponent
();
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
.
service
,
'
removeWIP
'
).
mockReturnValue
(
jest
.
spyOn
(
vm
.
service
,
'
removeWIP
'
).
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
:
mrObj
,
data
:
mrObj
,
});
});
...
@@ -92,7 +92,7 @@ describe('Wip', () => {
...
@@ -92,7 +92,7 @@ describe('Wip', () => {
);
);
});
});
it
(
'
should not show removeWIP button is user cannot update MR
'
,
done
=>
{
it
(
'
should not show removeWIP button is user cannot update MR
'
,
(
done
)
=>
{
vm
.
mr
.
removeWIPPath
=
''
;
vm
.
mr
.
removeWIPPath
=
''
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
...
...
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
View file @
dff561fa
...
@@ -15,7 +15,7 @@ describe('MrWidgetTerraformConainer', () => {
...
@@ -15,7 +15,7 @@ describe('MrWidgetTerraformConainer', () => {
const
propsData
=
{
endpoint
:
'
/path/to/terraform/report.json
'
};
const
propsData
=
{
endpoint
:
'
/path/to/terraform/report.json
'
};
const
findHeader
=
()
=>
wrapper
.
find
(
'
[data-testid="terraform-header-text"]
'
);
const
findHeader
=
()
=>
wrapper
.
find
(
'
[data-testid="terraform-header-text"]
'
);
const
findPlans
=
()
=>
wrapper
.
findAll
(
TerraformPlan
).
wrappers
.
map
(
x
=>
x
.
props
(
'
plan
'
));
const
findPlans
=
()
=>
wrapper
.
findAll
(
TerraformPlan
).
wrappers
.
map
(
(
x
)
=>
x
.
props
(
'
plan
'
));
const
mockPollingApi
=
(
response
,
body
,
header
)
=>
{
const
mockPollingApi
=
(
response
,
body
,
header
)
=>
{
mock
.
onGet
(
propsData
.
endpoint
).
reply
(
response
,
body
,
header
);
mock
.
onGet
(
propsData
.
endpoint
).
reply
(
response
,
body
,
header
);
...
...
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
View file @
dff561fa
...
@@ -14,7 +14,7 @@ describe('TerraformPlan', () => {
...
@@ -14,7 +14,7 @@ describe('TerraformPlan', () => {
const
findIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="change-type-icon"]
'
);
const
findIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="change-type-icon"]
'
);
const
findLogButton
=
()
=>
wrapper
.
find
(
'
[data-testid="terraform-report-link"]
'
);
const
findLogButton
=
()
=>
wrapper
.
find
(
'
[data-testid="terraform-report-link"]
'
);
const
mountWrapper
=
propsData
=>
{
const
mountWrapper
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
TerraformPlan
,
{
stubs
:
{
GlLink
,
GlSprintf
},
propsData
});
wrapper
=
shallowMount
(
TerraformPlan
,
{
stubs
:
{
GlLink
,
GlSprintf
},
propsData
});
};
};
...
...
spec/frontend/vue_mr_widget/deployment/deployment_spec.js
View file @
dff561fa
...
@@ -116,7 +116,7 @@ describe('Deployment component', () => {
...
@@ -116,7 +116,7 @@ describe('Deployment component', () => {
if
(
actionButtons
.
length
>
0
)
{
if
(
actionButtons
.
length
>
0
)
{
describe
(
'
renders the expected button group
'
,
()
=>
{
describe
(
'
renders the expected button group
'
,
()
=>
{
actionButtons
.
forEach
(
button
=>
{
actionButtons
.
forEach
(
(
button
)
=>
{
it
(
`renders
${
button
}
`
,
()
=>
{
it
(
`renders
${
button
}
`
,
()
=>
{
expect
(
wrapper
.
find
(
button
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
button
).
exists
()).
toBe
(
true
);
});
});
...
@@ -126,7 +126,7 @@ describe('Deployment component', () => {
...
@@ -126,7 +126,7 @@ describe('Deployment component', () => {
if
(
actionButtons
.
length
===
0
)
{
if
(
actionButtons
.
length
===
0
)
{
describe
(
'
does not render the button group
'
,
()
=>
{
describe
(
'
does not render the button group
'
,
()
=>
{
defaultGroup
.
forEach
(
button
=>
{
defaultGroup
.
forEach
(
(
button
)
=>
{
it
(
`does not render
${
button
}
`
,
()
=>
{
it
(
`does not render
${
button
}
`
,
()
=>
{
expect
(
wrapper
.
find
(
button
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
button
).
exists
()).
toBe
(
false
);
});
});
...
...
spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js
View file @
dff561fa
...
@@ -90,7 +90,7 @@ describe('Deployment View App button', () => {
...
@@ -90,7 +90,7 @@ describe('Deployment View App button', () => {
it
(
'
renders all the links to the review apps
'
,
()
=>
{
it
(
'
renders all the links to the review apps
'
,
()
=>
{
const
allUrls
=
wrapper
.
findAll
(
'
.js-deploy-url-menu-item
'
).
wrappers
;
const
allUrls
=
wrapper
.
findAll
(
'
.js-deploy-url-menu-item
'
).
wrappers
;
const
expectedUrls
=
deploymentMockData
.
changes
.
map
(
change
=>
change
.
external_url
);
const
expectedUrls
=
deploymentMockData
.
changes
.
map
(
(
change
)
=>
change
.
external_url
);
expectedUrls
.
forEach
((
expectedUrl
,
idx
)
=>
{
expectedUrls
.
forEach
((
expectedUrl
,
idx
)
=>
{
const
deployUrl
=
allUrls
[
idx
];
const
deployUrl
=
allUrls
[
idx
];
...
...
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
View file @
dff561fa
...
@@ -14,8 +14,8 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/consta
...
@@ -14,8 +14,8 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/consta
jest
.
mock
(
'
~/smart_interval
'
);
jest
.
mock
(
'
~/smart_interval
'
);
const
returnPromise
=
data
=>
const
returnPromise
=
(
data
)
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
resolve
({
data
,
data
,
});
});
...
@@ -180,7 +180,7 @@ describe('mrWidgetOptions', () => {
...
@@ -180,7 +180,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when merge request is opened
'
,
()
=>
{
describe
(
'
when merge request is opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
true
;
vm
.
mr
.
isOpen
=
true
;
vm
.
$nextTick
(
done
);
vm
.
$nextTick
(
done
);
});
});
...
@@ -191,7 +191,7 @@ describe('mrWidgetOptions', () => {
...
@@ -191,7 +191,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when merge request is not opened
'
,
()
=>
{
describe
(
'
when merge request is not opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
false
;
vm
.
mr
.
isOpen
=
false
;
vm
.
$nextTick
(
done
);
vm
.
$nextTick
(
done
);
});
});
...
@@ -208,7 +208,7 @@ describe('mrWidgetOptions', () => {
...
@@ -208,7 +208,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when merge request is opened
'
,
()
=>
{
describe
(
'
when merge request is opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
true
;
vm
.
mr
.
isOpen
=
true
;
vm
.
$nextTick
(
done
);
vm
.
$nextTick
(
done
);
});
});
...
@@ -222,7 +222,7 @@ describe('mrWidgetOptions', () => {
...
@@ -222,7 +222,7 @@ describe('mrWidgetOptions', () => {
describe
(
'
showMergePipelineForkWarning
'
,
()
=>
{
describe
(
'
showMergePipelineForkWarning
'
,
()
=>
{
describe
(
'
when the source project and target project are the same
'
,
()
=>
{
describe
(
'
when the source project and target project are the same
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
true
);
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
true
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
1
);
...
@@ -235,7 +235,7 @@ describe('mrWidgetOptions', () => {
...
@@ -235,7 +235,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when merge pipelines are not enabled
'
,
()
=>
{
describe
(
'
when merge pipelines are not enabled
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
false
);
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
false
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
...
@@ -248,7 +248,7 @@ describe('mrWidgetOptions', () => {
...
@@ -248,7 +248,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when merge pipelines are enabled _and_ the source project and target project are different
'
,
()
=>
{
describe
(
'
when merge pipelines are enabled _and_ the source project and target project are different
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
true
);
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
true
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
...
@@ -362,8 +362,8 @@ describe('mrWidgetOptions', () => {
...
@@ -362,8 +362,8 @@ describe('mrWidgetOptions', () => {
describe
(
'
bindEventHubListeners
'
,
()
=>
{
describe
(
'
bindEventHubListeners
'
,
()
=>
{
it
.
each
`
it
.
each
`
event | method | methodArgs
event | method | methodArgs
${
'
MRWidgetUpdateRequested
'
}
|
${
'
checkStatus
'
}
|
${
x
=>
[
x
]}
${
'
MRWidgetUpdateRequested
'
}
|
${
'
checkStatus
'
}
|
${
(
x
)
=>
[
x
]}
${
'
MRWidgetRebaseSuccess
'
}
|
${
'
checkStatus
'
}
|
${
x
=>
[
x
,
true
]}
${
'
MRWidgetRebaseSuccess
'
}
|
${
'
checkStatus
'
}
|
${
(
x
)
=>
[
x
,
true
]}
${
'
FetchActionsContent
'
}
|
${
'
fetchActionsContent
'
}
|
${()
=>
[]}
${
'
FetchActionsContent
'
}
|
${
'
fetchActionsContent
'
}
|
${()
=>
[]}
${
'
EnablePolling
'
}
|
${
'
resumePolling
'
}
|
${()
=>
[]}
${
'
EnablePolling
'
}
|
${
'
resumePolling
'
}
|
${()
=>
[]}
${
'
DisablePolling
'
}
|
${
'
stopPolling
'
}
|
${()
=>
[]}
${
'
DisablePolling
'
}
|
${
'
stopPolling
'
}
|
${()
=>
[]}
...
@@ -421,7 +421,7 @@ describe('mrWidgetOptions', () => {
...
@@ -421,7 +421,7 @@ describe('mrWidgetOptions', () => {
document
.
body
.
removeChild
(
document
.
getElementById
(
'
favicon
'
));
document
.
body
.
removeChild
(
document
.
getElementById
(
'
favicon
'
));
});
});
it
(
'
should call setFavicon method
'
,
done
=>
{
it
(
'
should call setFavicon method
'
,
(
done
)
=>
{
vm
.
mr
.
ciStatusFaviconPath
=
overlayDataUrl
;
vm
.
mr
.
ciStatusFaviconPath
=
overlayDataUrl
;
vm
.
setFaviconHelper
()
vm
.
setFaviconHelper
()
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -438,7 +438,7 @@ describe('mrWidgetOptions', () => {
...
@@ -438,7 +438,7 @@ describe('mrWidgetOptions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
should not call setFavicon when there is no ciStatusFaviconPath
'
,
done
=>
{
it
(
'
should not call setFavicon when there is no ciStatusFaviconPath
'
,
(
done
)
=>
{
vm
.
mr
.
ciStatusFaviconPath
=
null
;
vm
.
mr
.
ciStatusFaviconPath
=
null
;
vm
.
setFaviconHelper
()
vm
.
setFaviconHelper
()
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -513,7 +513,7 @@ describe('mrWidgetOptions', () => {
...
@@ -513,7 +513,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
rendering relatedLinks
'
,
()
=>
{
describe
(
'
rendering relatedLinks
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
relatedLinks
=
{
vm
.
mr
.
relatedLinks
=
{
assignToMe
:
null
,
assignToMe
:
null
,
closing
:
`
closing
:
`
...
@@ -530,7 +530,7 @@ describe('mrWidgetOptions', () => {
...
@@ -530,7 +530,7 @@ describe('mrWidgetOptions', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.close-related-link
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.close-related-link
'
)).
toBeDefined
();
});
});
it
(
'
does not render if state is nothingToMerge
'
,
done
=>
{
it
(
'
does not render if state is nothingToMerge
'
,
(
done
)
=>
{
vm
.
mr
.
state
=
stateKey
.
nothingToMerge
;
vm
.
mr
.
state
=
stateKey
.
nothingToMerge
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.close-related-link
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.close-related-link
'
)).
toBeNull
();
...
@@ -540,7 +540,7 @@ describe('mrWidgetOptions', () => {
...
@@ -540,7 +540,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
rendering source branch removal status
'
,
()
=>
{
describe
(
'
rendering source branch removal status
'
,
()
=>
{
it
(
'
renders when user cannot remove branch and branch should be removed
'
,
done
=>
{
it
(
'
renders when user cannot remove branch and branch should be removed
'
,
(
done
)
=>
{
vm
.
mr
.
canRemoveSourceBranch
=
false
;
vm
.
mr
.
canRemoveSourceBranch
=
false
;
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
state
=
'
readyToMerge
'
;
vm
.
mr
.
state
=
'
readyToMerge
'
;
...
@@ -557,7 +557,7 @@ describe('mrWidgetOptions', () => {
...
@@ -557,7 +557,7 @@ describe('mrWidgetOptions', () => {
});
});
});
});
it
(
'
does not render in merged state
'
,
done
=>
{
it
(
'
does not render in merged state
'
,
(
done
)
=>
{
vm
.
mr
.
canRemoveSourceBranch
=
false
;
vm
.
mr
.
canRemoveSourceBranch
=
false
;
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
state
=
'
merged
'
;
vm
.
mr
.
state
=
'
merged
'
;
...
@@ -601,7 +601,7 @@ describe('mrWidgetOptions', () => {
...
@@ -601,7 +601,7 @@ describe('mrWidgetOptions', () => {
status
:
SUCCESS
,
status
:
SUCCESS
,
};
};
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
deployments
.
push
(
vm
.
mr
.
deployments
.
push
(
{
{
...
deploymentMockData
,
...
deploymentMockData
,
...
@@ -636,7 +636,7 @@ describe('mrWidgetOptions', () => {
...
@@ -636,7 +636,7 @@ describe('mrWidgetOptions', () => {
describe
(
'
pipeline for target branch after merge
'
,
()
=>
{
describe
(
'
pipeline for target branch after merge
'
,
()
=>
{
describe
(
'
with information for target branch pipeline
'
,
()
=>
{
describe
(
'
with information for target branch pipeline
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
merged
'
;
vm
.
mr
.
state
=
'
merged
'
;
vm
.
mr
.
mergePipeline
=
{
vm
.
mr
.
mergePipeline
=
{
id
:
127
,
id
:
127
,
...
@@ -752,7 +752,7 @@ describe('mrWidgetOptions', () => {
...
@@ -752,7 +752,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
with post merge deployments
'
,
()
=>
{
describe
(
'
with post merge deployments
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
postMergeDeployments
=
[
vm
.
mr
.
postMergeDeployments
=
[
{
{
id
:
15
,
id
:
15
,
...
@@ -795,7 +795,7 @@ describe('mrWidgetOptions', () => {
...
@@ -795,7 +795,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
without information for target branch pipeline
'
,
()
=>
{
describe
(
'
without information for target branch pipeline
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
merged
'
;
vm
.
mr
.
state
=
'
merged
'
;
vm
.
$nextTick
(
done
);
vm
.
$nextTick
(
done
);
...
@@ -807,7 +807,7 @@ describe('mrWidgetOptions', () => {
...
@@ -807,7 +807,7 @@ describe('mrWidgetOptions', () => {
});
});
describe
(
'
when state is not merged
'
,
()
=>
{
describe
(
'
when state is not merged
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
archived
'
;
vm
.
mr
.
state
=
'
archived
'
;
vm
.
$nextTick
(
done
);
vm
.
$nextTick
(
done
);
...
@@ -887,7 +887,7 @@ describe('mrWidgetOptions', () => {
...
@@ -887,7 +887,7 @@ describe('mrWidgetOptions', () => {
{
isDismissedSuggestPipeline
:
true
},
{
isDismissedSuggestPipeline
:
true
},
{
mergeRequestAddCiConfigPath
:
null
},
{
mergeRequestAddCiConfigPath
:
null
},
{
hasCI
:
true
},
{
hasCI
:
true
},
])(
'
with %s, should not suggest pipeline
'
,
async
obj
=>
{
])(
'
with %s, should not suggest pipeline
'
,
async
(
obj
)
=>
{
Object
.
assign
(
vm
.
mr
,
obj
);
Object
.
assign
(
vm
.
mr
,
obj
);
await
vm
.
$nextTick
();
await
vm
.
$nextTick
();
...
...
spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js
View file @
dff561fa
...
@@ -22,7 +22,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -22,7 +22,7 @@ describe('Artifacts App Store Actions', () => {
});
});
describe
(
'
setEndpoint
'
,
()
=>
{
describe
(
'
setEndpoint
'
,
()
=>
{
it
(
'
should commit SET_ENDPOINT mutation
'
,
done
=>
{
it
(
'
should commit SET_ENDPOINT mutation
'
,
(
done
)
=>
{
testAction
(
testAction
(
setEndpoint
,
setEndpoint
,
'
endpoint.json
'
,
'
endpoint.json
'
,
...
@@ -35,7 +35,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -35,7 +35,7 @@ describe('Artifacts App Store Actions', () => {
});
});
describe
(
'
requestArtifacts
'
,
()
=>
{
describe
(
'
requestArtifacts
'
,
()
=>
{
it
(
'
should commit REQUEST_ARTIFACTS mutation
'
,
done
=>
{
it
(
'
should commit REQUEST_ARTIFACTS mutation
'
,
(
done
)
=>
{
testAction
(
testAction
(
requestArtifacts
,
requestArtifacts
,
null
,
null
,
...
@@ -62,7 +62,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -62,7 +62,7 @@ describe('Artifacts App Store Actions', () => {
});
});
describe
(
'
success
'
,
()
=>
{
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsSuccess
'
,
done
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsSuccess
'
,
(
done
)
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
replyOnce
(
200
,
[
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
replyOnce
(
200
,
[
{
{
text
:
'
result.txt
'
,
text
:
'
result.txt
'
,
...
@@ -106,7 +106,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -106,7 +106,7 @@ describe('Artifacts App Store Actions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
reply
(
500
);
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
reply
(
500
);
});
});
it
(
'
dispatches requestArtifacts and receiveArtifactsError
'
,
done
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsError
'
,
(
done
)
=>
{
testAction
(
testAction
(
fetchArtifacts
,
fetchArtifacts
,
null
,
null
,
...
@@ -127,7 +127,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -127,7 +127,7 @@ describe('Artifacts App Store Actions', () => {
});
});
describe
(
'
receiveArtifactsSuccess
'
,
()
=>
{
describe
(
'
receiveArtifactsSuccess
'
,
()
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200
'
,
done
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200
'
,
(
done
)
=>
{
testAction
(
testAction
(
receiveArtifactsSuccess
,
receiveArtifactsSuccess
,
{
data
:
{
summary
:
{}
},
status
:
200
},
{
data
:
{
summary
:
{}
},
status
:
200
},
...
@@ -138,7 +138,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -138,7 +138,7 @@ describe('Artifacts App Store Actions', () => {
);
);
});
});
it
(
'
should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204
'
,
done
=>
{
it
(
'
should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204
'
,
(
done
)
=>
{
testAction
(
testAction
(
receiveArtifactsSuccess
,
receiveArtifactsSuccess
,
{
data
:
{
summary
:
{}
},
status
:
204
},
{
data
:
{
summary
:
{}
},
status
:
204
},
...
@@ -151,7 +151,7 @@ describe('Artifacts App Store Actions', () => {
...
@@ -151,7 +151,7 @@ describe('Artifacts App Store Actions', () => {
});
});
describe
(
'
receiveArtifactsError
'
,
()
=>
{
describe
(
'
receiveArtifactsError
'
,
()
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_ERROR mutation
'
,
done
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_ERROR mutation
'
,
(
done
)
=>
{
testAction
(
testAction
(
receiveArtifactsError
,
receiveArtifactsError
,
null
,
null
,
...
...
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
View file @
dff561fa
...
@@ -156,7 +156,7 @@ describe('MergeRequestStore', () => {
...
@@ -156,7 +156,7 @@ describe('MergeRequestStore', () => {
it
.
each
([
'
sast_comparison_path
'
,
'
secret_scanning_comparison_path
'
])(
it
.
each
([
'
sast_comparison_path
'
,
'
secret_scanning_comparison_path
'
])(
'
should set %s path
'
,
'
should set %s path
'
,
property
=>
{
(
property
)
=>
{
// Ensure something is set in the mock data
// Ensure something is set in the mock data
expect
(
property
in
mockData
).
toBe
(
true
);
expect
(
property
in
mockData
).
toBe
(
true
);
const
expectedValue
=
mockData
[
property
];
const
expectedValue
=
mockData
[
property
];
...
...
spec/frontend/vue_shared/components/actions_button_spec.js
View file @
dff561fa
...
@@ -40,7 +40,7 @@ describe('Actions button component', () => {
...
@@ -40,7 +40,7 @@ describe('Actions button component', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
getTooltip
=
child
=>
{
const
getTooltip
=
(
child
)
=>
{
const
directiveBinding
=
getBinding
(
child
.
element
,
'
gl-tooltip
'
);
const
directiveBinding
=
getBinding
(
child
.
element
,
'
gl-tooltip
'
);
return
directiveBinding
.
value
;
return
directiveBinding
.
value
;
...
@@ -52,7 +52,7 @@ describe('Actions button component', () => {
...
@@ -52,7 +52,7 @@ describe('Actions button component', () => {
const
parseDropdownItems
=
()
=>
const
parseDropdownItems
=
()
=>
findDropdown
()
findDropdown
()
.
findAll
(
'
gl-dropdown-item-stub,gl-dropdown-divider-stub
'
)
.
findAll
(
'
gl-dropdown-item-stub,gl-dropdown-divider-stub
'
)
.
wrappers
.
map
(
x
=>
{
.
wrappers
.
map
(
(
x
)
=>
{
if
(
x
.
is
(
'
gl-dropdown-divider-stub
'
))
{
if
(
x
.
is
(
'
gl-dropdown-divider-stub
'
))
{
return
{
type
:
'
divider
'
};
return
{
type
:
'
divider
'
};
}
}
...
...
spec/frontend/vue_shared/components/alert_details_table_spec.js
View file @
dff561fa
...
@@ -45,13 +45,13 @@ describe('AlertDetails', () => {
...
@@ -45,13 +45,13 @@ describe('AlertDetails', () => {
const
findTableComponent
=
()
=>
wrapper
.
find
(
GlTable
);
const
findTableComponent
=
()
=>
wrapper
.
find
(
GlTable
);
const
findTableKeys
=
()
=>
findTableComponent
().
findAll
(
'
tbody td:first-child
'
);
const
findTableKeys
=
()
=>
findTableComponent
().
findAll
(
'
tbody td:first-child
'
);
const
findTableFieldValueByKey
=
fieldKey
=>
const
findTableFieldValueByKey
=
(
fieldKey
)
=>
findTableComponent
()
findTableComponent
()
.
findAll
(
'
tbody tr
'
)
.
findAll
(
'
tbody tr
'
)
.
filter
(
row
=>
row
.
text
().
includes
(
fieldKey
))
.
filter
(
(
row
)
=>
row
.
text
().
includes
(
fieldKey
))
.
at
(
0
)
.
at
(
0
)
.
find
(
'
td:nth-child(2)
'
);
.
find
(
'
td:nth-child(2)
'
);
const
findTableField
=
(
fields
,
fieldName
)
=>
fields
.
filter
(
row
=>
row
.
text
()
===
fieldName
);
const
findTableField
=
(
fields
,
fieldName
)
=>
fields
.
filter
(
(
row
)
=>
row
.
text
()
===
fieldName
);
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
empty state
'
,
()
=>
{
describe
(
'
empty state
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/awards_list_spec.js
View file @
dff561fa
...
@@ -58,10 +58,10 @@ describe('vue_shared/components/awards_list', () => {
...
@@ -58,10 +58,10 @@ describe('vue_shared/components/awards_list', () => {
wrapper
=
mount
(
AwardsList
,
{
propsData
:
props
});
wrapper
=
mount
(
AwardsList
,
{
propsData
:
props
});
};
};
const
matchingEmojiTag
=
name
=>
expect
.
stringMatching
(
`gl-emoji data-name="
${
name
}
"`
);
const
matchingEmojiTag
=
(
name
)
=>
expect
.
stringMatching
(
`gl-emoji data-name="
${
name
}
"`
);
const
findAwardButtons
=
()
=>
wrapper
.
findAll
(
'
[data-testid="award-button"]
'
);
const
findAwardButtons
=
()
=>
wrapper
.
findAll
(
'
[data-testid="award-button"]
'
);
const
findAwardsData
=
()
=>
const
findAwardsData
=
()
=>
findAwardButtons
().
wrappers
.
map
(
x
=>
{
findAwardButtons
().
wrappers
.
map
(
(
x
)
=>
{
return
{
return
{
classes
:
x
.
classes
(),
classes
:
x
.
classes
(),
title
:
x
.
attributes
(
'
title
'
),
title
:
x
.
attributes
(
'
title
'
),
...
@@ -205,7 +205,7 @@ describe('vue_shared/components/awards_list', () => {
...
@@ -205,7 +205,7 @@ describe('vue_shared/components/awards_list', () => {
const
buttons
=
findAwardButtons
();
const
buttons
=
findAwardButtons
();
expect
(
buttons
.
length
).
toBe
(
7
);
expect
(
buttons
.
length
).
toBe
(
7
);
expect
(
buttons
.
wrappers
.
every
(
x
=>
x
.
classes
(
'
disabled
'
))).
toBe
(
true
);
expect
(
buttons
.
wrappers
.
every
(
(
x
)
=>
x
.
classes
(
'
disabled
'
))).
toBe
(
true
);
});
});
});
});
...
...
spec/frontend/vue_shared/components/ci_badge_link_spec.js
View file @
dff561fa
...
@@ -81,7 +81,7 @@ describe('CI Badge Link Component', () => {
...
@@ -81,7 +81,7 @@ describe('CI Badge Link Component', () => {
});
});
it
(
'
should render each status badge
'
,
()
=>
{
it
(
'
should render each status badge
'
,
()
=>
{
Object
.
keys
(
statuses
).
map
(
status
=>
{
Object
.
keys
(
statuses
).
map
(
(
status
)
=>
{
vm
=
mountComponent
(
CIBadge
,
{
status
:
statuses
[
status
]
});
vm
=
mountComponent
(
CIBadge
,
{
status
:
statuses
[
status
]
});
expect
(
vm
.
$el
.
getAttribute
(
'
href
'
)).
toEqual
(
statuses
[
status
].
details_path
);
expect
(
vm
.
$el
.
getAttribute
(
'
href
'
)).
toEqual
(
statuses
[
status
].
details_path
);
...
...
spec/frontend/vue_shared/components/commit_spec.js
View file @
dff561fa
...
@@ -7,14 +7,14 @@ describe('Commit component', () => {
...
@@ -7,14 +7,14 @@ describe('Commit component', () => {
let
props
;
let
props
;
let
wrapper
;
let
wrapper
;
const
findIcon
=
name
=>
{
const
findIcon
=
(
name
)
=>
{
const
icons
=
wrapper
.
findAll
(
GlIcon
).
filter
(
c
=>
c
.
attributes
(
'
name
'
)
===
name
);
const
icons
=
wrapper
.
findAll
(
GlIcon
).
filter
(
(
c
)
=>
c
.
attributes
(
'
name
'
)
===
name
);
return
icons
.
length
?
icons
.
at
(
0
)
:
icons
;
return
icons
.
length
?
icons
.
at
(
0
)
:
icons
;
};
};
const
findUserAvatar
=
()
=>
wrapper
.
find
(
UserAvatarLink
);
const
findUserAvatar
=
()
=>
wrapper
.
find
(
UserAvatarLink
);
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
CommitComponent
,
{
wrapper
=
shallowMount
(
CommitComponent
,
{
propsData
,
propsData
,
});
});
...
...
spec/frontend/vue_shared/components/confirm_modal_spec.js
View file @
dff561fa
...
@@ -53,7 +53,7 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -53,7 +53,7 @@ describe('vue_shared/components/confirm_modal', () => {
const
findFormData
=
()
=>
const
findFormData
=
()
=>
findForm
()
findForm
()
.
findAll
(
'
input
'
)
.
findAll
(
'
input
'
)
.
wrappers
.
map
(
x
=>
({
name
:
x
.
attributes
(
'
name
'
),
value
:
x
.
attributes
(
'
value
'
)
}));
.
wrappers
.
map
(
(
x
)
=>
({
name
:
x
.
attributes
(
'
name
'
),
value
:
x
.
attributes
(
'
value
'
)
}));
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
describe
(
'
when modal data is set
'
,
()
=>
{
describe
(
'
when modal data is set
'
,
()
=>
{
...
...
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