Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
cc43e66b
Commit
cc43e66b
authored
2 years ago
by
Laurent Deketelaere
Committed by
Kushal Pandya
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove localVue in Sidebar Header spec
parent
1089fb13
No related branches found
No related tags found
1 merge request
!106088
Remove localVue in Sidebar Header spec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/frontend/jobs/components/job/sidebar_header_spec.js
+6
-20
6 additions, 20 deletions
spec/frontend/jobs/components/job/sidebar_header_spec.js
with
6 additions
and
20 deletions
spec/frontend/jobs/components/job/sidebar_header_spec.js
+
6
−
20
View file @
cc43e66b
import
{
createLocal
Vue
}
from
'
@
vue
/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
...
...
@@ -8,8 +8,7 @@ import JobRetryButton from '~/jobs/components/job/sidebar/job_sidebar_retry_butt
import
getJobQuery
from
'
~/jobs/components/job/graphql/queries/get_job.query.graphql
'
;
import
{
mockFullPath
,
mockId
,
mockJobResponse
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
defaultProvide
=
{
projectPath
:
mockFullPath
,
...
...
@@ -17,8 +16,6 @@ const defaultProvide = {
describe
(
'
Sidebar Header
'
,
()
=>
{
let
wrapper
;
let
mockApollo
;
let
getJobQueryResponse
;
const
createComponent
=
({
options
=
{},
props
=
{},
restJob
=
{}
}
=
{})
=>
{
wrapper
=
shallowMountExtended
(
SidebarHeader
,
{
...
...
@@ -35,13 +32,14 @@ describe('Sidebar Header', () => {
};
const
createComponentWithApollo
=
async
({
props
=
{},
restJob
=
{}
}
=
{})
=>
{
const
getJobQueryResponse
=
jest
.
fn
().
mockResolvedValue
(
mockJobResponse
);
const
requestHandlers
=
[[
getJobQuery
,
getJobQueryResponse
]];
mockApollo
=
createMockApollo
(
requestHandlers
);
const
apolloProvider
=
createMockApollo
(
requestHandlers
);
const
options
=
{
localVue
,
apolloProvider
:
mockApollo
,
apolloProvider
,
};
createComponent
({
...
...
@@ -58,19 +56,7 @@ describe('Sidebar Header', () => {
const
findJobName
=
()
=>
wrapper
.
findByTestId
(
'
job-name
'
);
const
findRetryButton
=
()
=>
wrapper
.
findComponent
(
JobRetryButton
);
beforeEach
(
async
()
=>
{
getJobQueryResponse
=
jest
.
fn
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
when rendering contents
'
,
()
=>
{
beforeEach
(
async
()
=>
{
getJobQueryResponse
.
mockResolvedValue
(
mockJobResponse
);
});
it
(
'
renders the correct job name
'
,
async
()
=>
{
await
createComponentWithApollo
();
expect
(
findJobName
().
text
()).
toBe
(
mockJobResponse
.
data
.
project
.
job
.
name
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment