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
3e01a16b
Commit
3e01a16b
authored
Apr 25, 2020
by
Jackie Fraser
Committed by
Enrique Alcantara
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate mr_widget_auto_merge_enabled_spec to Jest
parent
5587cf3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
ee/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
...et/components/states/mr_widget_auto_merge_enabled_spec.js
+7
-9
No files found.
ee/spec/
javascripts
/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
→
ee/spec/
frontend
/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
View file @
3e01a16b
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
trimText
}
from
'
spec/helpers/text_helper
'
;
import
MRWidgetAutoMergeEnabled
from
'
~/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue
'
;
import
MRWidgetAutoMergeEnabled
from
'
~/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue
'
;
import
{
import
{
MWPS_MERGE_STRATEGY
,
MWPS_MERGE_STRATEGY
,
...
@@ -8,7 +7,6 @@ import {
...
@@ -8,7 +7,6 @@ import {
}
from
'
~/vue_merge_request_widget/constants
'
;
}
from
'
~/vue_merge_request_widget/constants
'
;
describe
(
'
MRWidgetAutoMergeEnabled
'
,
()
=>
{
describe
(
'
MRWidgetAutoMergeEnabled
'
,
()
=>
{
const
localVue
=
createLocalVue
();
let
wrapper
;
let
wrapper
;
let
vm
;
let
vm
;
...
@@ -31,12 +29,11 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -31,12 +29,11 @@ describe('MRWidgetAutoMergeEnabled', () => {
};
};
const
factory
=
(
mrUpdates
=
{})
=>
{
const
factory
=
(
mrUpdates
=
{})
=>
{
wrapper
=
shallowMount
(
localVue
.
extend
(
MRWidgetAutoMergeEnabled
)
,
{
wrapper
=
shallowMount
(
MRWidgetAutoMergeEnabled
,
{
propsData
:
{
propsData
:
{
mr
:
{
...
mr
,
...
mrUpdates
},
mr
:
{
...
mr
,
...
mrUpdates
},
service
,
service
,
},
},
localVue
,
});
});
({
vm
}
=
wrapper
);
({
vm
}
=
wrapper
);
...
@@ -44,6 +41,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -44,6 +41,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
wrapper
=
null
;
});
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
computed
'
,
()
=>
{
...
@@ -125,7 +123,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -125,7 +123,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
mergeTrainsCount
:
0
,
mergeTrainsCount
:
0
,
});
});
const
statusText
=
trimText
(
vm
.
$el
.
querySelector
(
'
.js-status-text-after-author
'
).
innerText
);
const
statusText
=
wrapper
.
find
(
'
.js-status-text-after-author
'
).
text
(
);
expect
(
statusText
).
toBe
(
'
to start a merge train when the pipeline succeeds
'
);
expect
(
statusText
).
toBe
(
'
to start a merge train when the pipeline succeeds
'
);
});
});
...
@@ -136,7 +134,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -136,7 +134,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
mergeTrainsCount
:
1
,
mergeTrainsCount
:
1
,
});
});
const
statusText
=
trimText
(
vm
.
$el
.
querySelector
(
'
.js-status-text-after-author
'
).
innerText
);
const
statusText
=
wrapper
.
find
(
'
.js-status-text-after-author
'
).
text
(
);
expect
(
statusText
).
toBe
(
'
to be added to the merge train when the pipeline succeeds
'
);
expect
(
statusText
).
toBe
(
'
to be added to the merge train when the pipeline succeeds
'
);
});
});
...
@@ -144,7 +142,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -144,7 +142,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
it
(
'
should render the cancel button as "Cancel automatic merge" if MTWPS is selected
'
,
()
=>
{
it
(
'
should render the cancel button as "Cancel automatic merge" if MTWPS is selected
'
,
()
=>
{
factory
({
autoMergeStrategy
:
MTWPS_MERGE_STRATEGY
});
factory
({
autoMergeStrategy
:
MTWPS_MERGE_STRATEGY
});
const
cancelButtonText
=
trimText
(
vm
.
$el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
innerText
);
const
cancelButtonText
=
wrapper
.
find
(
'
.js-cancel-auto-merge
'
).
text
(
);
expect
(
cancelButtonText
).
toBe
(
'
Cancel automatic merge
'
);
expect
(
cancelButtonText
).
toBe
(
'
Cancel automatic merge
'
);
});
});
...
@@ -153,7 +151,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
...
@@ -153,7 +151,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
it
(
'
should render the cancel button as "Remove from merge train" if the pipeline has been added to the merge train
'
,
()
=>
{
it
(
'
should render the cancel button as "Remove from merge train" if the pipeline has been added to the merge train
'
,
()
=>
{
factory
({
autoMergeStrategy
:
MT_MERGE_STRATEGY
});
factory
({
autoMergeStrategy
:
MT_MERGE_STRATEGY
});
const
cancelButtonText
=
trimText
(
vm
.
$el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
innerText
);
const
cancelButtonText
=
wrapper
.
find
(
'
.js-cancel-auto-merge
'
).
text
(
);
expect
(
cancelButtonText
).
toBe
(
'
Remove from merge train
'
);
expect
(
cancelButtonText
).
toBe
(
'
Remove from merge train
'
);
});
});
...
...
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