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
d2963b8f
Commit
d2963b8f
authored
Apr 28, 2020
by
Jackie Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate mr_widget_pipeline_container_spec to jest
parent
02127143
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
...mr_widget/components/mr_widget_pipeline_container_spec.js
+28
-27
No files found.
spec/
javascripts
/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
→
spec/
frontend
/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
View file @
d2963b8f
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
MrWidgetPipelineContainer
from
'
~/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
'
;
import
MrWidgetPipeline
from
'
~/vue_merge_request_widget/components/mr_widget_pipeline.vue
'
;
import
ArtifactsApp
from
'
~/vue_merge_request_widget/components/artifacts_list_app.vue
'
;
import
{
mockStore
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
()
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
describe
(
'
MrWidgetPipelineContainer
'
,
()
=>
{
let
wrapper
;
let
mock
;
const
factory
=
(
props
=
{})
=>
{
wrapper
=
mount
(
localVue
.
extend
(
MrWidgetPipelineContainer
)
,
{
wrapper
=
mount
(
MrWidgetPipelineContainer
,
{
propsData
:
{
mr
:
Object
.
assign
({},
mockStore
),
...
props
,
},
localVue
,
});
};
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
().
reply
(
200
,
{});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
...
...
@@ -30,21 +35,19 @@ describe('MrWidgetPipelineContainer', () => {
it
(
'
renders pipeline
'
,
()
=>
{
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
props
()).
toEqual
(
jasmine
.
objectContaining
({
pipeline
:
mockStore
.
pipeline
,
pipelineCoverageDelta
:
mockStore
.
pipelineCoverageDelta
,
ciStatus
:
mockStore
.
ciStatus
,
hasCi
:
mockStore
.
hasCI
,
sourceBranch
:
mockStore
.
sourceBranch
,
sourceBranchLink
:
mockStore
.
sourceBranchLink
,
}),
);
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
props
()).
toMatchObject
({
pipeline
:
mockStore
.
pipeline
,
pipelineCoverageDelta
:
mockStore
.
pipelineCoverageDelta
,
ciStatus
:
mockStore
.
ciStatus
,
hasCi
:
mockStore
.
hasCI
,
sourceBranch
:
mockStore
.
sourceBranch
,
sourceBranchLink
:
mockStore
.
sourceBranchLink
,
});
});
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
deployments
.
map
(
dep
=>
jasmine
.
objectContaining
({
expect
.
objectContaining
({
deployment
:
dep
,
showMetrics
:
false
,
}),
...
...
@@ -65,21 +68,19 @@ describe('MrWidgetPipelineContainer', () => {
it
(
'
renders pipeline
'
,
()
=>
{
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
props
()).
toEqual
(
jasmine
.
objectContaining
({
pipeline
:
mockStore
.
mergePipeline
,
pipelineCoverageDelta
:
mockStore
.
pipelineCoverageDelta
,
ciStatus
:
mockStore
.
ciStatus
,
hasCi
:
mockStore
.
hasCI
,
sourceBranch
:
mockStore
.
targetBranch
,
sourceBranchLink
:
mockStore
.
targetBranch
,
}),
);
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
props
()).
toMatchObject
({
pipeline
:
mockStore
.
mergePipeline
,
pipelineCoverageDelta
:
mockStore
.
pipelineCoverageDelta
,
ciStatus
:
mockStore
.
ciStatus
,
hasCi
:
mockStore
.
hasCI
,
sourceBranch
:
mockStore
.
targetBranch
,
sourceBranchLink
:
mockStore
.
targetBranch
,
});
});
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
(
dep
=>
jasmine
.
objectContaining
({
expect
.
objectContaining
({
deployment
:
dep
,
showMetrics
:
true
,
}),
...
...
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