Commit 15b66d38 authored by Savas Vedova's avatar Savas Vedova

Apply code review suggestions

Rename text.vue component to value.vue and make value
field use the same component as they are similar.
parent 77b70355
......@@ -6,6 +6,7 @@ export const REPORT_TYPES = {
diff: 'diff',
namedList: 'named-list',
text: 'text',
value: 'value',
};
const REPORT_TYPE_TO_COMPONENT_MAP = {
......@@ -13,7 +14,8 @@ const REPORT_TYPE_TO_COMPONENT_MAP = {
[REPORT_TYPES.url]: () => import('./url.vue'),
[REPORT_TYPES.diff]: () => import('./diff.vue'),
[REPORT_TYPES.namedList]: () => import('./named_list.vue'),
[REPORT_TYPES.text]: () => import('./text.vue'),
[REPORT_TYPES.text]: () => import('./value.vue'),
[REPORT_TYPES.value]: () => import('./value.vue'),
};
export const getComponentNameForType = (reportType) =>
......
......@@ -33,14 +33,6 @@ export const isOfTypeList = isOfType(REPORT_TYPES.list);
*/
export const isOfTypeNamedList = isOfType(REPORT_TYPES.namedList);
/**
* Check if the given report is of type text
*
* @param {{ type: string } } reportItem
* @returns boolean
*/
export const isOfTypeText = isOfType(REPORT_TYPES.text);
/**
* Check if the current report item is of that list and is not nested deeper than the maximum depth
*
......
......@@ -18,9 +18,13 @@ const TEST_DATA = {
after: 'bar',
},
[REPORT_TYPES.text]: {
name: 'some-field',
name: 'some-string-field',
value: 'some-value',
},
[REPORT_TYPES.value]: {
name: 'some-numeric-field',
value: 15,
},
};
describe('ee/vulnerabilities/components/generic_report/report_item.vue', () => {
......
import { shallowMount } from '@vue/test-utils';
import Text from 'ee/vulnerabilities/components/generic_report/types/text.vue';
import Text from 'ee/vulnerabilities/components/generic_report/types/value.vue';
describe('ee/vulnerabilities/components/generic_report/types/text.vue', () => {
describe('ee/vulnerabilities/components/generic_report/types/value.vue', () => {
let wrapper;
describe.each`
......
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