Commit eb911339 authored by Dave Pisek's avatar Dave Pisek

Bootstrap action button spec

* Add foundation to refactor specs for moving away from mount helper
* Add spec to check the create-jira-issues button has the correct title
parent d4d621c6
......@@ -116,6 +116,7 @@ export default {
variant="success"
category="secondary"
icon="issue-new"
data-testid="create-issue"
@click="handleCreateIssue"
/>
<template v-if="canDismissVulnerability">
......
import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_action_buttons.vue';
import { mount } from '@vue/test-utils';
import VulnerabilityActionButtons from 'ee/security_dashboard/components/vulnerability_action_buttons.vue';
import createStore from 'ee/security_dashboard/store';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
......@@ -9,10 +10,28 @@ import { resetStore } from '../helpers';
import mockDataVulnerabilities from '../store/modules/vulnerabilities/data/mock_data_vulnerabilities';
describe('Security Dashboard Action Buttons', () => {
const Component = Vue.extend(component);
const Component = Vue.extend(VulnerabilityActionButtons);
let vm;
let store;
let props;
let wrapper;
const defaultProps = {
vulnerability: mockDataVulnerabilities[0],
canCreateIssue: true,
canDismissVulnerability: true,
};
const createComponent = ({ propsData, ...options }) => {
return mount(VulnerabilityActionButtons, {
store: createStore(),
propsData: {
...defaultProps,
...propsData,
},
...options,
});
};
beforeEach(() => {
store = createStore();
......@@ -84,6 +103,28 @@ describe('Security Dashboard Action Buttons', () => {
flashError: true,
});
});
describe('with Jira issues for vulnerabilities enabled', () => {
beforeEach(() => {
props = {
vulnerability: mockDataVulnerabilities[8],
canCreateIssue: true,
};
wrapper = createComponent({
propsData: {
vulnerability: mockDataVulnerabilities[8],
canCreateIssue: true,
},
provide: {
glFeatures: { jiraForVulnerabilities: true },
},
});
});
it('should render the correct tooltip', () => {
expect(wrapper.find('.js-create-issue').attributes('title')).toBe('Create Jira issue');
});
});
});
describe('Dismiss Vulnerability Button', () => {
......
......@@ -568,4 +568,61 @@ export default [
state: 'opened',
blob_path: '',
},
{
id: 9,
create_jira_issue_url: 'http://jira-project.atlassian.com/report',
report_type: 'container_scanning',
name: 'CVE-2018-1000001 in glibc',
severity: 'high',
confidence: 'unknown',
scanner: {
external_id: 'clair',
name: 'Clair',
vendor: 'GitLab',
},
identifiers: [
{
external_type: 'cve',
external_id: 'CVE-2018-1000001',
name: 'CVE-2018-1000001',
url: 'https://security-tracker.debian.org/tracker/CVE-2018-1000001',
},
],
project_fingerprint: 'af08ab5aa899af9e74318ebc23684c9aa728ab7c',
create_vulnerability_feedback_issue_path: '/gitlab-org/sec-reports/vulnerability_feedback',
create_vulnerability_feedback_merge_request_path:
'/gitlab-org/sec-reports/vulnerability_feedback',
create_vulnerability_feedback_dismissal_path: '/gitlab-org/sec-reports/vulnerability_feedback',
project: {
id: 19,
name: 'sec-reports',
full_path: '/gitlab-org/sec-reports',
full_name: 'Gitlab Org / sec-reports',
},
dismissal_feedback: null,
issue_feedback: null,
merge_request_feedback: null,
description:
'In glibc 2.26 and earlier there is confusion in the usage of getcwd() by realpath() which can be used to write before the destination buffer leading to a buffer underflow and potential code execution.',
links: [
{
url: 'https://security-tracker.debian.org/tracker/CVE-2018-1000001',
},
],
location: {
image:
'registry.gitlab.com/groulot/container-scanning-test/master:5f21de6956aee99ddb68ae49498662d9872f50ff',
operating_system: 'debian:9',
dependency: {
package: {
name: 'glibc',
},
version: '2.24-11+deb9u3',
},
},
remediations: null,
solution: null,
state: 'opened',
blob_path: '',
},
];
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment