Commit e61825bc authored by Alexander Turinske's avatar Alexander Turinske

Remove dead code around vulnerability.instances

- remove dead code
- update tests
parent 70063148
<script>
import { GlFriendlyWrap, GlLink } from '@gitlab/ui';
import CodeBlock from '~/vue_shared/components/code_block.vue';
import Icon from '~/vue_shared/components/icon.vue';
import ExpandButton from '~/vue_shared/components/expand_button.vue';
import SeverityBadge from './severity_badge.vue';
import getFileLocation from '../store/utils/get_file_location';
import VulnerabilityDetail from './vulnerability_detail.vue';
......@@ -13,9 +11,7 @@ export default {
name: 'VulnerabilityDetails',
components: {
CodeBlock,
ExpandButton,
GlFriendlyWrap,
Icon,
SeverityBadge,
VulnerabilityDetail,
GlLink,
......@@ -70,9 +66,6 @@ export default {
links() {
return this.asNonEmptyListOrNull(this.vulnerability.links);
},
instances() {
return this.asNonEmptyListOrNull(this.vulnerability.instances);
},
requestHeaders() {
return this.headersToFormattedString(this.vulnerability.request?.headers);
},
......@@ -234,35 +227,5 @@ export default {
<span v-if="hasMoreValues(i, links)">,&nbsp;</span>
</span>
</vulnerability-detail>
<vulnerability-detail v-if="instances" :label="s__('Vulnerability|Instances')">
<div class="info-well">
<ul class="report-block-list">
<li v-for="(instance, i) in instances" :key="i" class="report-block-list-issue">
<div class="report-block-list-icon gl-mr-2 failed">
<icon :size="32" name="status_failed_borderless" />
</div>
<div class="report-block-list-issue-description gl-mt-2 gl-mb-2">
<div class="report-block-list-issue-description-text">
{{ instance.method }}
</div>
<div class="report-block-list-issue-description-link">
<gl-link :href="instance.uri" target="_blank" rel="nofollow" class="break-link">
{{ instance.uri }}
</gl-link>
</div>
<expand-button v-if="instance.evidence">
<template #expanded>
<pre
class="block report-block-dast-code prepend-top-10 report-block-issue-code"
v-text="instance.evidence"
></pre>
</template>
</expand-button>
</div>
</li>
</ul>
</div>
</vulnerability-detail>
</div>
</template>
......@@ -186,59 +186,5 @@ key2: value2"
<!---->
</span>
</vulnerability-detail-stub>
<vulnerability-detail-stub
label="Instances"
>
<div
class="info-well"
>
<ul
class="report-block-list"
>
<li
class="report-block-list-issue"
>
<div
class="report-block-list-icon gl-mr-2 failed"
>
<icon-stub
name="status_failed_borderless"
size="32"
/>
</div>
<div
class="report-block-list-issue-description gl-mt-2 gl-mb-2"
>
<div
class="report-block-list-issue-description-text"
>
POST
</div>
<div
class="report-block-list-issue-description-link"
>
<gl-link-stub
class="break-link"
href="/bar"
rel="nofollow"
target="_blank"
>
/bar
</gl-link-stub>
</div>
<expand-button-stub />
</div>
</li>
</ul>
</div>
</vulnerability-detail-stub>
</div>
`;
......@@ -100,7 +100,6 @@ describe('VulnerabilityDetails component', () => {
},
links: [{ url: badUrl }],
identifiers: [{ name: 'BAD_URL', url: badUrl }],
instances: [{ method: 'GET', uri: badUrl }],
});
componentFactory(vulnerability);
......@@ -122,39 +121,6 @@ describe('VulnerabilityDetails component', () => {
isExternal: false,
});
});
it('for the instances field', () => {
expectSafeLink({
link: wrapper.find('.report-block-list-issue-description-link .break-link'),
href: 'about:blank',
text: badUrl,
});
});
});
describe('with instances', () => {
beforeEach(() => {
const vulnerability = makeVulnerability({
instances: [
{ uri: 'http://192.168.32.236:3001/explore?sort=latest_activity_desc' },
{ uri: 'http://192.168.32.236:3001/help/user/group/subgroups/index.md' },
],
});
componentFactory(vulnerability);
});
it('renders instances list', () => {
const instances = wrapper.findAll('.report-block-list li').wrappers;
expect(instances[0].text()).toContain(
'http://192.168.32.236:3001/explore?sort=latest_activity_desc',
);
expect(instances[1].text()).toContain(
'http://192.168.32.236:3001/help/user/group/subgroups/index.md',
);
});
});
describe('with coverage fuzzing information', () => {
......@@ -305,13 +271,6 @@ describe('VulnerabilityDetails component', () => {
it('renders correctly', () => {
factory(
makeVulnerability({
instances: [
{
method: 'POST',
evidence: 'foo',
uri: '/bar',
},
],
request: {
url: 'http://foo.bar/path',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
......
......@@ -26530,9 +26530,6 @@ msgstr ""
msgid "Vulnerability|Image"
msgstr ""
msgid "Vulnerability|Instances"
msgstr ""
msgid "Vulnerability|Links"
msgstr ""
......
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