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
0d0c8aa3
Commit
0d0c8aa3
authored
Mar 12, 2020
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix create issue error by providing the missing param
parent
fd13f8ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js
...curity_dashboard/store/modules/vulnerabilities/actions.js
+1
-0
ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/actions_spec.js
...y_dashboard/store/modules/vulnerabilities/actions_spec.js
+82
-0
No files found.
ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js
View file @
0d0c8aa3
...
...
@@ -121,6 +121,7 @@ export const createIssue = ({ dispatch }, { vulnerability, flashError }) => {
vulnerability_feedback
:
{
feedback_type
:
'
issue
'
,
category
:
vulnerability
.
report_type
,
project_fingerprint
:
vulnerability
.
project_fingerprint
,
vulnerability_data
:
{
...
vulnerability
,
category
:
vulnerability
.
report_type
,
...
...
ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/actions_spec.js
0 → 100644
View file @
0d0c8aa3
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
createState
from
'
ee/security_dashboard/store/modules/unscanned_projects/state
'
;
import
*
as
actions
from
'
ee/security_dashboard/store/modules/vulnerabilities/actions
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
describe
(
'
EE Vulnerabilities actions
'
,
()
=>
{
const
mockEndpoint
=
'
mock-list-endpoint
'
;
const
mockResponse
=
[{
key_foo
:
'
valueFoo
'
}];
let
mockAxios
;
let
state
;
let
vulnerability
;
beforeEach
(()
=>
{
mockAxios
=
new
MockAdapter
(
axios
);
state
=
createState
();
vulnerability
=
{
create_vulnerability_feedback_issue_path
:
mockEndpoint
,
report_type
:
'
issue
'
,
project_fingerprint
:
'
some-fingerprint
'
,
};
});
afterEach
(()
=>
{
mockAxios
.
restore
();
});
describe
(
'
createIssue
'
,
()
=>
{
it
(
'
calls the createIssue endpoint and receives a success response
'
,
done
=>
{
mockAxios
.
onPost
(
mockEndpoint
).
replyOnce
(
200
,
mockResponse
);
const
spy
=
jest
.
spyOn
(
axios
,
'
post
'
);
return
testAction
(
actions
.
createIssue
,
{
vulnerability
,
},
state
,
[],
[
{
type
:
'
requestCreateIssue
'
},
{
type
:
'
receiveCreateIssueSuccess
'
,
payload
:
mockResponse
},
],
()
=>
{
expect
(
spy
).
toHaveBeenCalledWith
(
mockEndpoint
,
{
vulnerability_feedback
:
{
category
:
'
issue
'
,
feedback_type
:
'
issue
'
,
project_fingerprint
:
'
some-fingerprint
'
,
vulnerability_data
:
{
category
:
'
issue
'
,
create_vulnerability_feedback_issue_path
:
mockEndpoint
,
project_fingerprint
:
'
some-fingerprint
'
,
report_type
:
'
issue
'
,
},
},
});
done
();
},
);
});
it
(
'
handles an API error by dispatching "receiveCreateIssueError"
'
,
done
=>
{
mockAxios
.
onPost
(
mockEndpoint
).
replyOnce
(
500
);
return
testAction
(
actions
.
createIssue
,
{
vulnerability
,
},
state
,
[],
[
{
type
:
'
requestCreateIssue
'
},
{
type
:
'
receiveCreateIssueError
'
,
payload
:
{
flashError
:
undefined
}
},
],
done
,
);
});
});
});
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