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
spec/frontend/shortcuts_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
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/user_popovers_spec.js
View file @
dff561fa
...
...
@@ -26,12 +26,12 @@ describe('User Popovers', () => {
loadFixtures
(
fixtureTemplate
);
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
);
jest
.
spyOn
(
UsersCache
,
'
retrieveStatusById
'
)
.
mockImplementation
(
userId
=>
userStatusCacheSpy
(
userId
));
.
mockImplementation
(
(
userId
)
=>
userStatusCacheSpy
(
userId
));
popovers
=
initUserPopovers
(
document
.
querySelectorAll
(
selector
));
});
...
...
spec/frontend/vue_alerts_spec.js
View file @
dff561fa
...
...
@@ -27,7 +27,7 @@ describe('VueAlerts', () => {
setHTMLFixture
(
alerts
.
map
(
x
=>
`
(
x
)
=>
`
<div class="js-vue-alert"
data-dismissible="
${
x
.
dismissible
}
"
data-title="
${
x
.
title
}
"
...
...
@@ -42,15 +42,15 @@ describe('VueAlerts', () => {
const
findJsHooks
=
()
=>
document
.
querySelectorAll
(
'
.js-vue-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
(),
html
:
alert
.
querySelector
(
'
.gl-alert-body div
'
).
innerHTML
,
dismissible
:
Boolean
(
alert
.
querySelector
(
'
.gl-alert-dismiss
'
)),
primaryButtonText
:
alert
.
querySelector
(
'
.gl-alert-action
'
).
textContent
.
trim
(),
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
'
,
()
=>
{
...
...
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';
jest
.
mock
(
'
~/flash
'
);
const
TEST_HELP_PATH
=
'
help/path
'
;
const
testApprovedBy
=
()
=>
[
1
,
7
,
10
].
map
(
id
=>
({
id
}));
const
testApprovedBy
=
()
=>
[
1
,
7
,
10
].
map
(
(
id
)
=>
({
id
}));
const
testApprovals
=
()
=>
({
approved
:
false
,
approved_by
:
testApprovedBy
().
map
(
user
=>
({
user
})),
approved_by
:
testApprovedBy
().
map
(
(
user
)
=>
({
user
})),
approval_rules_left
:
[],
approvals_left
:
4
,
suggested_approvers
:
[],
...
...
@@ -31,7 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] });
// For some reason, the `Promise.resolve()` needs to be deferred
// or the timing doesn't work.
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
'
,
()
=>
{
let
wrapper
;
...
...
@@ -114,7 +114,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
when fetch approvals error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
fetchApprovals
'
).
mockReturnValue
(
Promise
.
reject
());
createComponent
();
waitForTick
(
done
);
...
...
@@ -131,7 +131,7 @@ describe('MRWidget approvals', () => {
describe
(
'
action button
'
,
()
=>
{
describe
(
'
when mr is closed
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
isOpen
=
false
;
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_can_approve
=
true
;
...
...
@@ -146,7 +146,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
when user cannot approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_has_approved
=
false
;
mr
.
approvals
.
user_can_approve
=
false
;
...
...
@@ -166,7 +166,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and MR is unapproved
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
waitForTick
(
done
);
});
...
...
@@ -186,7 +186,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
with no approvers
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
approved_by
=
[];
createComponent
();
waitForTick
(
done
);
...
...
@@ -202,7 +202,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
with approvers
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
approved_by
=
[{
user
:
{
id
:
7
}
}];
createComponent
();
waitForTick
(
done
);
...
...
@@ -219,7 +219,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
when approve action is clicked
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
waitForTick
(
done
);
});
...
...
@@ -238,7 +238,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and after loading
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
});
...
...
@@ -257,7 +257,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
approveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
...
...
@@ -271,7 +271,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
when user has approved
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_has_approved
=
true
;
mr
.
approvals
.
user_can_approve
=
false
;
...
...
@@ -289,7 +289,7 @@ describe('MRWidget approvals', () => {
describe
(
'
when revoke action is clicked
'
,
()
=>
{
describe
(
'
and successful
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
});
...
...
@@ -308,7 +308,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and error
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
service
,
'
unapproveMergeRequest
'
).
mockReturnValue
(
Promise
.
reject
());
findAction
().
vm
.
$emit
(
'
click
'
);
waitForTick
(
done
);
...
...
@@ -331,7 +331,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and can approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_can_approve
=
true
;
createComponent
();
...
...
@@ -348,7 +348,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
and cannot approve
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
mr
.
approvals
.
user_can_approve
=
false
;
createComponent
();
...
...
@@ -367,7 +367,7 @@ describe('MRWidget approvals', () => {
});
describe
(
'
approvals summary
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
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
import
{
toNounSeriesText
}
from
'
~/lib/utils/grammar
'
;
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
TEST_APPROVALS_LEFT
=
3
;
...
...
spec/frontend/vue_mr_widget/components/artifacts_list_spec.js
View file @
dff561fa
...
...
@@ -10,7 +10,7 @@ describe('Artifacts List', () => {
artifacts
:
artifactsList
,
};
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
ArtifactsList
,
{
propsData
:
{
...
props
,
...
...
spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
View file @
dff561fa
...
...
@@ -8,7 +8,7 @@ describe('Merge Request Collapsible Extension', () => {
title
:
'
View artifacts
'
,
};
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
wrapper
=
mount
(
MrCollapsibleSection
,
{
propsData
:
{
...
props
,
...
...
spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js
View file @
dff561fa
...
...
@@ -19,7 +19,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe
(
'
when type is not provided
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
expect
(
wrapper
.
classes
()).
not
.
toContain
(
'
warning_message
'
);
...
...
@@ -29,7 +29,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe
(
'
when type === "danger"
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
setProps
({
type
:
'
danger
'
});
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
danger_message
'
);
...
...
@@ -40,7 +40,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe
(
'
when type === "warning"
'
,
()
=>
{
it
(
'
should render a red message
'
,
done
=>
{
it
(
'
should render a red message
'
,
(
done
)
=>
{
wrapper
.
setProps
({
type
:
'
warning
'
});
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
warning_message
'
);
...
...
@@ -51,7 +51,7 @@ describe('MrWidgetAlertMessage', () => {
});
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
(()
=>
{
const
link
=
wrapper
.
find
(
GlLink
);
...
...
@@ -62,7 +62,7 @@ describe('MrWidgetAlertMessage', () => {
});
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
.
vm
.
$nextTick
(()
=>
{
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', () => {
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
.
$nextTick
(()
=>
{
...
...
@@ -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
'
;
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', () => {
describe
(
'
loadMetrics
'
,
()
=>
{
const
returnServicePromise
=
()
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
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
(
vm
,
'
computeGraphData
'
).
mockImplementation
(()
=>
{});
...
...
@@ -179,7 +179,7 @@ describe('MemoryUsage', () => {
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
.
hasMetrics
=
false
;
vm
.
loadFailed
=
false
;
...
...
@@ -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
jest
.
spyOn
(
console
,
'
warn
'
).
mockImplementation
();
...
...
@@ -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
.
hasMetrics
=
false
;
vm
.
loadFailed
=
true
;
...
...
@@ -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
.
hasMetrics
=
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', () => {
});
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
deployments
.
map
(
dep
=>
const
expectedProps
=
mockStore
.
deployments
.
map
(
(
dep
)
=>
expect
.
objectContaining
({
deployment
:
dep
,
showMetrics
:
false
,
...
...
@@ -55,7 +55,7 @@ describe('MrWidgetPipelineContainer', () => {
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', () => {
});
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
(
dep
=>
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
(
(
dep
)
=>
expect
.
objectContaining
({
deployment
:
dep
,
showMetrics
:
true
,
...
...
@@ -88,7 +88,7 @@ describe('MrWidgetPipelineContainer', () => {
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', () => {
it
.
each
(
mockData
.
buildsWithCoverage
)(
'
should have name and coverage for build %s listed in tooltip
'
,
build
=>
{
(
build
)
=>
{
const
tooltipText
=
findPipelineCoverageTooltipText
();
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', () => {
);
});
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!
'
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -98,7 +98,7 @@ describe('Merge request widget rebase component', () => {
});
describe
(
'
methods
'
,
()
=>
{
it
(
'
checkRebaseStatus
'
,
done
=>
{
it
(
'
checkRebaseStatus
'
,
(
done
)
=>
{
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
vm
=
mountComponent
(
Component
,
{
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
describe
(
'
MRWidgetRelatedLinks
'
,
()
=>
{
let
vm
;
const
createComponent
=
data
=>
{
const
createComponent
=
(
data
)
=>
{
const
Component
=
Vue
.
extend
(
relatedLinksComponent
);
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', () => {
describe
(
'
methods
'
,
()
=>
{
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
=
{
is_new_mr_data
:
true
,
};
jest
.
spyOn
(
vm
.
service
,
'
cancelAutomaticMerge
'
).
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
mrObj
,
});
...
...
@@ -130,7 +130,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
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
(
Promise
.
resolve
({
data
:
{
...
...
@@ -173,7 +173,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
.
nextTick
(()
=>
{
...
...
@@ -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
.
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_
describe
(
'
Commits header component
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
CommitsHeader
,
{
propsData
:
{
isSquashEnabled
:
false
,
...
...
@@ -110,21 +110,21 @@ describe('Commits header component', () => {
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
(()
=>
{
expect
(
findCommitToggle
().
attributes
(
'
aria-label
'
)).
toBe
(
'
Collapse
'
);
done
();
});
});
it
(
'
has a chevron-down icon
'
,
done
=>
{
it
(
'
has a chevron-down icon
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
findCommitToggle
().
props
(
'
icon
'
)).
toBe
(
'
chevron-down
'
);
done
();
});
});
it
(
'
has a collapse text
'
,
done
=>
{
it
(
'
has a collapse text
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
findHeaderWrapper
().
text
()).
toBe
(
'
Collapse
'
);
done
();
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
dff561fa
...
...
@@ -54,7 +54,7 @@ describe('MRWidgetConflicts', () => {
vm
.
destroy
();
});
[
false
,
true
].
forEach
(
featureEnabled
=>
{
[
false
,
true
].
forEach
(
(
featureEnabled
)
=>
{
describe
(
`with GraphQL feature flag
${
featureEnabled
?
'
enabled
'
:
'
disabled
'
}
`
,
()
=>
{
beforeEach
(()
=>
{
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', () => {
});
describe
(
'
mergeError
'
,
()
=>
{
it
(
'
removes forced line breaks
'
,
done
=>
{
it
(
'
removes forced line breaks
'
,
(
done
)
=>
{
mr
.
mergeError
=
'
contains<br />line breaks<br />
'
;
Vue
.
nextTick
()
...
...
@@ -98,7 +98,7 @@ describe('MRWidgetFailedToMerge', () => {
});
describe
(
'
while it is refreshing
'
,
()
=>
{
it
(
'
renders Refresing now
'
,
done
=>
{
it
(
'
renders Refresing now
'
,
(
done
)
=>
{
vm
.
isRefreshing
=
true
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
();
Vue
.
nextTick
(()
=>
{
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', () => {
describe
(
'
methods
'
,
()
=>
{
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
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
{
message
:
'
Branch was deleted
'
,
...
...
@@ -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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -189,7 +189,7 @@ describe('MRWidgetMerged', () => {
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
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -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
.
sourceBranchRemoved
=
false
;
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
View file @
dff561fa
...
...
@@ -25,7 +25,7 @@ describe('MRWidgetMissingBranch', () => {
wrapper
.
destroy
();
});
[
true
,
false
].
forEach
(
mergeRequestWidgetGraphql
=>
{
[
true
,
false
].
forEach
(
(
mergeRequestWidgetGraphql
)
=>
{
describe
(
`widget GraphQL feature flag is
${
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', () => ({
const
commitMessage
=
'
This is the commit message
'
;
const
squashCommitMessage
=
'
This is the squash commit message
'
;
const
commitMessageWithDescription
=
'
This is the commit message description
'
;
const
createTestMr
=
customConfig
=>
{
const
createTestMr
=
(
customConfig
)
=>
{
const
mr
=
{
isPipelineActive
:
false
,
pipeline
:
null
,
...
...
@@ -346,8 +346,8 @@ describe('ReadyToMerge', () => {
});
describe
(
'
handleMergeButtonClick
'
,
()
=>
{
const
returnPromise
=
status
=>
new
Promise
(
resolve
=>
{
const
returnPromise
=
(
status
)
=>
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
{
status
,
...
...
@@ -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
(
vm
.
service
,
'
merge
'
)
...
...
@@ -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
(
vm
.
service
,
'
merge
'
).
mockReturnValue
(
returnPromise
(
'
failed
'
));
vm
.
handleMergeButtonClick
(
false
,
true
);
...
...
@@ -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
,
'
initiateMergePolling
'
).
mockImplementation
(()
=>
{});
vm
.
handleMergeButtonClick
();
...
...
@@ -433,8 +433,8 @@ describe('ReadyToMerge', () => {
});
describe
(
'
handleMergePolling
'
,
()
=>
{
const
returnPromise
=
state
=>
new
Promise
(
resolve
=>
{
const
returnPromise
=
(
state
)
=>
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
{
state
,
...
...
@@ -447,7 +447,7 @@ describe('ReadyToMerge', () => {
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
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
'
merged
'
));
jest
.
spyOn
(
vm
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
...
@@ -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
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
...
@@ -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
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
...
@@ -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
,
'
initiateRemoveSourceBranchPolling
'
).
mockImplementation
(()
=>
{});
...
...
@@ -547,8 +547,8 @@ describe('ReadyToMerge', () => {
});
describe
(
'
handleRemoveBranchPolling
'
,
()
=>
{
const
returnPromise
=
state
=>
new
Promise
(
resolve
=>
{
const
returnPromise
=
(
state
)
=>
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
{
source_branch_exists
:
state
,
...
...
@@ -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
(
vm
.
service
,
'
poll
'
).
mockReturnValue
(
returnPromise
(
false
));
...
...
@@ -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
));
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();
describe
(
'
Squash before merge component
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
localVue
.
extend
(
SquashBeforeMerge
),
{
localVue
,
propsData
:
{
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js
View file @
dff561fa
...
...
@@ -47,12 +47,12 @@ describe('Wip', () => {
};
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
();
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
.
service
,
'
removeWIP
'
).
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
:
mrObj
,
});
...
...
@@ -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
=
''
;
Vue
.
nextTick
(()
=>
{
...
...
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
View file @
dff561fa
...
...
@@ -15,7 +15,7 @@ describe('MrWidgetTerraformConainer', () => {
const
propsData
=
{
endpoint
:
'
/path/to/terraform/report.json
'
};
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
)
=>
{
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', () => {
const
findIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="change-type-icon"]
'
);
const
findLogButton
=
()
=>
wrapper
.
find
(
'
[data-testid="terraform-report-link"]
'
);
const
mountWrapper
=
propsData
=>
{
const
mountWrapper
=
(
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', () => {
if
(
actionButtons
.
length
>
0
)
{
describe
(
'
renders the expected button group
'
,
()
=>
{
actionButtons
.
forEach
(
button
=>
{
actionButtons
.
forEach
(
(
button
)
=>
{
it
(
`renders
${
button
}
`
,
()
=>
{
expect
(
wrapper
.
find
(
button
).
exists
()).
toBe
(
true
);
});
...
...
@@ -126,7 +126,7 @@ describe('Deployment component', () => {
if
(
actionButtons
.
length
===
0
)
{
describe
(
'
does not render the button group
'
,
()
=>
{
defaultGroup
.
forEach
(
button
=>
{
defaultGroup
.
forEach
(
(
button
)
=>
{
it
(
`does not render
${
button
}
`
,
()
=>
{
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', () => {
it
(
'
renders all the links to the review apps
'
,
()
=>
{
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
)
=>
{
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
jest
.
mock
(
'
~/smart_interval
'
);
const
returnPromise
=
data
=>
new
Promise
(
resolve
=>
{
const
returnPromise
=
(
data
)
=>
new
Promise
(
(
resolve
)
=>
{
resolve
({
data
,
});
...
...
@@ -180,7 +180,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
when merge request is opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
true
;
vm
.
$nextTick
(
done
);
});
...
...
@@ -191,7 +191,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
when merge request is not opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
false
;
vm
.
$nextTick
(
done
);
});
...
...
@@ -208,7 +208,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
when merge request is opened
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
isOpen
=
true
;
vm
.
$nextTick
(
done
);
});
...
...
@@ -222,7 +222,7 @@ describe('mrWidgetOptions', () => {
describe
(
'
showMergePipelineForkWarning
'
,
()
=>
{
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
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
1
);
...
...
@@ -235,7 +235,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
when merge pipelines are not enabled
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
Vue
.
set
(
vm
.
mr
,
'
mergePipelinesEnabled
'
,
false
);
Vue
.
set
(
vm
.
mr
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
...
...
@@ -248,7 +248,7 @@ describe('mrWidgetOptions', () => {
});
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
,
'
sourceProjectId
'
,
1
);
Vue
.
set
(
vm
.
mr
,
'
targetProjectId
'
,
2
);
...
...
@@ -362,8 +362,8 @@ describe('mrWidgetOptions', () => {
describe
(
'
bindEventHubListeners
'
,
()
=>
{
it
.
each
`
event | method | methodArgs
${
'
MRWidgetUpdateRequested
'
}
|
${
'
checkStatus
'
}
|
${
x
=>
[
x
]}
${
'
MRWidgetRebaseSuccess
'
}
|
${
'
checkStatus
'
}
|
${
x
=>
[
x
,
true
]}
${
'
MRWidgetUpdateRequested
'
}
|
${
'
checkStatus
'
}
|
${
(
x
)
=>
[
x
]}
${
'
MRWidgetRebaseSuccess
'
}
|
${
'
checkStatus
'
}
|
${
(
x
)
=>
[
x
,
true
]}
${
'
FetchActionsContent
'
}
|
${
'
fetchActionsContent
'
}
|
${()
=>
[]}
${
'
EnablePolling
'
}
|
${
'
resumePolling
'
}
|
${()
=>
[]}
${
'
DisablePolling
'
}
|
${
'
stopPolling
'
}
|
${()
=>
[]}
...
...
@@ -421,7 +421,7 @@ describe('mrWidgetOptions', () => {
document
.
body
.
removeChild
(
document
.
getElementById
(
'
favicon
'
));
});
it
(
'
should call setFavicon method
'
,
done
=>
{
it
(
'
should call setFavicon method
'
,
(
done
)
=>
{
vm
.
mr
.
ciStatusFaviconPath
=
overlayDataUrl
;
vm
.
setFaviconHelper
()
.
then
(()
=>
{
...
...
@@ -438,7 +438,7 @@ describe('mrWidgetOptions', () => {
.
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
.
setFaviconHelper
()
.
then
(()
=>
{
...
...
@@ -513,7 +513,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
rendering relatedLinks
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
relatedLinks
=
{
assignToMe
:
null
,
closing
:
`
...
...
@@ -530,7 +530,7 @@ describe('mrWidgetOptions', () => {
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
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.close-related-link
'
)).
toBeNull
();
...
...
@@ -540,7 +540,7 @@ describe('mrWidgetOptions', () => {
});
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
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
state
=
'
readyToMerge
'
;
...
...
@@ -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
.
shouldRemoveSourceBranch
=
true
;
vm
.
mr
.
state
=
'
merged
'
;
...
...
@@ -601,7 +601,7 @@ describe('mrWidgetOptions', () => {
status
:
SUCCESS
,
};
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
deployments
.
push
(
{
...
deploymentMockData
,
...
...
@@ -636,7 +636,7 @@ describe('mrWidgetOptions', () => {
describe
(
'
pipeline for target branch after merge
'
,
()
=>
{
describe
(
'
with information for target branch pipeline
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
merged
'
;
vm
.
mr
.
mergePipeline
=
{
id
:
127
,
...
...
@@ -752,7 +752,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
with post merge deployments
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
postMergeDeployments
=
[
{
id
:
15
,
...
...
@@ -795,7 +795,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
without information for target branch pipeline
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
merged
'
;
vm
.
$nextTick
(
done
);
...
...
@@ -807,7 +807,7 @@ describe('mrWidgetOptions', () => {
});
describe
(
'
when state is not merged
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
mr
.
state
=
'
archived
'
;
vm
.
$nextTick
(
done
);
...
...
@@ -887,7 +887,7 @@ describe('mrWidgetOptions', () => {
{
isDismissedSuggestPipeline
:
true
},
{
mergeRequestAddCiConfigPath
:
null
},
{
hasCI
:
true
},
])(
'
with %s, should not suggest pipeline
'
,
async
obj
=>
{
])(
'
with %s, should not suggest pipeline
'
,
async
(
obj
)
=>
{
Object
.
assign
(
vm
.
mr
,
obj
);
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', () => {
});
describe
(
'
setEndpoint
'
,
()
=>
{
it
(
'
should commit SET_ENDPOINT mutation
'
,
done
=>
{
it
(
'
should commit SET_ENDPOINT mutation
'
,
(
done
)
=>
{
testAction
(
setEndpoint
,
'
endpoint.json
'
,
...
...
@@ -35,7 +35,7 @@ describe('Artifacts App Store Actions', () => {
});
describe
(
'
requestArtifacts
'
,
()
=>
{
it
(
'
should commit REQUEST_ARTIFACTS mutation
'
,
done
=>
{
it
(
'
should commit REQUEST_ARTIFACTS mutation
'
,
(
done
)
=>
{
testAction
(
requestArtifacts
,
null
,
...
...
@@ -62,7 +62,7 @@ describe('Artifacts App Store Actions', () => {
});
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsSuccess
'
,
done
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsSuccess
'
,
(
done
)
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
replyOnce
(
200
,
[
{
text
:
'
result.txt
'
,
...
...
@@ -106,7 +106,7 @@ describe('Artifacts App Store Actions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
reply
(
500
);
});
it
(
'
dispatches requestArtifacts and receiveArtifactsError
'
,
done
=>
{
it
(
'
dispatches requestArtifacts and receiveArtifactsError
'
,
(
done
)
=>
{
testAction
(
fetchArtifacts
,
null
,
...
...
@@ -127,7 +127,7 @@ describe('Artifacts App Store Actions', () => {
});
describe
(
'
receiveArtifactsSuccess
'
,
()
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200
'
,
done
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200
'
,
(
done
)
=>
{
testAction
(
receiveArtifactsSuccess
,
{
data
:
{
summary
:
{}
},
status
:
200
},
...
...
@@ -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
(
receiveArtifactsSuccess
,
{
data
:
{
summary
:
{}
},
status
:
204
},
...
...
@@ -151,7 +151,7 @@ describe('Artifacts App Store Actions', () => {
});
describe
(
'
receiveArtifactsError
'
,
()
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_ERROR mutation
'
,
done
=>
{
it
(
'
should commit RECEIVE_ARTIFACTS_ERROR mutation
'
,
(
done
)
=>
{
testAction
(
receiveArtifactsError
,
null
,
...
...
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
View file @
dff561fa
...
...
@@ -156,7 +156,7 @@ describe('MergeRequestStore', () => {
it
.
each
([
'
sast_comparison_path
'
,
'
secret_scanning_comparison_path
'
])(
'
should set %s path
'
,
property
=>
{
(
property
)
=>
{
// Ensure something is set in the mock data
expect
(
property
in
mockData
).
toBe
(
true
);
const
expectedValue
=
mockData
[
property
];
...
...
spec/frontend/vue_shared/components/actions_button_spec.js
View file @
dff561fa
...
...
@@ -40,7 +40,7 @@ describe('Actions button component', () => {
wrapper
.
destroy
();
});
const
getTooltip
=
child
=>
{
const
getTooltip
=
(
child
)
=>
{
const
directiveBinding
=
getBinding
(
child
.
element
,
'
gl-tooltip
'
);
return
directiveBinding
.
value
;
...
...
@@ -52,7 +52,7 @@ describe('Actions button component', () => {
const
parseDropdownItems
=
()
=>
findDropdown
()
.
findAll
(
'
gl-dropdown-item-stub,gl-dropdown-divider-stub
'
)
.
wrappers
.
map
(
x
=>
{
.
wrappers
.
map
(
(
x
)
=>
{
if
(
x
.
is
(
'
gl-dropdown-divider-stub
'
))
{
return
{
type
:
'
divider
'
};
}
...
...
spec/frontend/vue_shared/components/alert_details_table_spec.js
View file @
dff561fa
...
...
@@ -45,13 +45,13 @@ describe('AlertDetails', () => {
const
findTableComponent
=
()
=>
wrapper
.
find
(
GlTable
);
const
findTableKeys
=
()
=>
findTableComponent
().
findAll
(
'
tbody td:first-child
'
);
const
findTableFieldValueByKey
=
fieldKey
=>
const
findTableFieldValueByKey
=
(
fieldKey
)
=>
findTableComponent
()
.
findAll
(
'
tbody tr
'
)
.
filter
(
row
=>
row
.
text
().
includes
(
fieldKey
))
.
filter
(
(
row
)
=>
row
.
text
().
includes
(
fieldKey
))
.
at
(
0
)
.
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
(
'
empty state
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/awards_list_spec.js
View file @
dff561fa
...
...
@@ -58,10 +58,10 @@ describe('vue_shared/components/awards_list', () => {
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
findAwardsData
=
()
=>
findAwardButtons
().
wrappers
.
map
(
x
=>
{
findAwardButtons
().
wrappers
.
map
(
(
x
)
=>
{
return
{
classes
:
x
.
classes
(),
title
:
x
.
attributes
(
'
title
'
),
...
...
@@ -205,7 +205,7 @@ describe('vue_shared/components/awards_list', () => {
const
buttons
=
findAwardButtons
();
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', () => {
});
it
(
'
should render each status badge
'
,
()
=>
{
Object
.
keys
(
statuses
).
map
(
status
=>
{
Object
.
keys
(
statuses
).
map
(
(
status
)
=>
{
vm
=
mountComponent
(
CIBadge
,
{
status
:
statuses
[
status
]
});
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', () => {
let
props
;
let
wrapper
;
const
findIcon
=
name
=>
{
const
icons
=
wrapper
.
findAll
(
GlIcon
).
filter
(
c
=>
c
.
attributes
(
'
name
'
)
===
name
);
const
findIcon
=
(
name
)
=>
{
const
icons
=
wrapper
.
findAll
(
GlIcon
).
filter
(
(
c
)
=>
c
.
attributes
(
'
name
'
)
===
name
);
return
icons
.
length
?
icons
.
at
(
0
)
:
icons
;
};
const
findUserAvatar
=
()
=>
wrapper
.
find
(
UserAvatarLink
);
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
CommitComponent
,
{
propsData
,
});
...
...
spec/frontend/vue_shared/components/confirm_modal_spec.js
View file @
dff561fa
...
...
@@ -53,7 +53,7 @@ describe('vue_shared/components/confirm_modal', () => {
const
findFormData
=
()
=>
findForm
()
.
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
(
'
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