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
877a700e
Commit
877a700e
authored
Oct 11, 2021
by
Dave Pisek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reviewer feedback: Use withApollo factory
parent
0dd9d2ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
ee/spec/frontend/security_dashboard/components/pipeline/pipeline_security_dashboard_spec.js
...d/components/pipeline/pipeline_security_dashboard_spec.js
+11
-9
No files found.
ee/spec/frontend/security_dashboard/components/pipeline/pipeline_security_dashboard_spec.js
View file @
877a700e
...
@@ -41,11 +41,7 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -41,11 +41,7 @@ describe('Pipeline Security Dashboard component', () => {
const
findVulnerabilityReport
=
()
=>
wrapper
.
findComponent
(
VulnerabilityReport
);
const
findVulnerabilityReport
=
()
=>
wrapper
.
findComponent
(
VulnerabilityReport
);
const
findScanErrorsAlert
=
()
=>
wrapper
.
findComponent
(
ScanErrorsAlert
);
const
findScanErrorsAlert
=
()
=>
wrapper
.
findComponent
(
ScanErrorsAlert
);
const
factory
=
({
stubs
,
provide
,
requestHandlers
}
=
{})
=>
{
const
factory
=
({
stubs
,
provide
,
apolloProvider
}
=
{})
=>
{
if
(
requestHandlers
)
{
localVue
.
use
(
VueApollo
);
}
store
=
new
Vuex
.
Store
({
store
=
new
Vuex
.
Store
({
modules
:
{
modules
:
{
vulnerabilities
:
{
vulnerabilities
:
{
...
@@ -67,7 +63,7 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -67,7 +63,7 @@ describe('Pipeline Security Dashboard component', () => {
wrapper
=
shallowMount
(
PipelineSecurityDashboard
,
{
wrapper
=
shallowMount
(
PipelineSecurityDashboard
,
{
localVue
,
localVue
,
...(
requestHandlers
&&
{
apolloProvider
:
createMockApollo
(
requestHandlers
)
})
,
apolloProvider
,
store
,
store
,
provide
:
{
provide
:
{
projectId
,
projectId
,
...
@@ -88,6 +84,12 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -88,6 +84,12 @@ describe('Pipeline Security Dashboard component', () => {
});
});
};
};
const
factoryWithApollo
=
({
requestHandlers
})
=>
{
localVue
.
use
(
VueApollo
);
factory
({
apolloProvider
:
createMockApollo
(
requestHandlers
)
});
};
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
...
@@ -160,7 +162,7 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -160,7 +162,7 @@ describe('Pipeline Security Dashboard component', () => {
describe
(
'
scans error alert
'
,
()
=>
{
describe
(
'
scans error alert
'
,
()
=>
{
describe
(
'
with errors
'
,
()
=>
{
describe
(
'
with errors
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
factory
({
factory
WithApollo
({
requestHandlers
:
[
requestHandlers
:
[
[
[
pipelineSecurityReportSummaryQuery
,
pipelineSecurityReportSummaryQuery
,
...
@@ -177,7 +179,7 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -177,7 +179,7 @@ describe('Pipeline Security Dashboard component', () => {
describe
(
'
without errors
'
,
()
=>
{
describe
(
'
without errors
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
factory
({
factory
WithApollo
({
requestHandlers
:
[
requestHandlers
:
[
[
[
pipelineSecurityReportSummaryQuery
,
pipelineSecurityReportSummaryQuery
,
...
@@ -201,7 +203,7 @@ describe('Pipeline Security Dashboard component', () => {
...
@@ -201,7 +203,7 @@ describe('Pipeline Security Dashboard component', () => {
`
(
`
(
'
shows the summary is "$shouldShowReportSummary"
'
,
'
shows the summary is "$shouldShowReportSummary"
'
,
async
({
response
,
shouldShowReportSummary
})
=>
{
async
({
response
,
shouldShowReportSummary
})
=>
{
factory
({
factory
WithApollo
({
requestHandlers
:
[
requestHandlers
:
[
[
pipelineSecurityReportSummaryQuery
,
jest
.
fn
().
mockResolvedValueOnce
(
response
)],
[
pipelineSecurityReportSummaryQuery
,
jest
.
fn
().
mockResolvedValueOnce
(
response
)],
],
],
...
...
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