Commit f50cb38a authored by Savas Vedova's avatar Savas Vedova

Fallback to toString method instead of computing the value

parent 3def11a6
......@@ -7,17 +7,8 @@ export default {
required: true,
},
},
computed: {
printValue() {
if (typeof this.value === 'boolean') {
return this.value ? 'true' : 'false';
}
return this.value;
},
},
};
</script>
<template>
<span>{{ printValue }}</span>
<span>{{ value }}</span>
</template>
......@@ -5,12 +5,12 @@ describe('ee/vulnerabilities/components/generic_report/types/value.vue', () => {
let wrapper;
describe.each`
field type | value | printValue
${'string'} | ${'some string'} | ${'some string'}
${'number'} | ${8} | ${'8'}
${'boolean'} | ${true} | ${'true'}
${'boolean'} | ${false} | ${'false'}
`('with value of type "$fieldType"', ({ fieldType, value, printValue }) => {
field type | value
${'string'} | ${'some string'}
${'number'} | ${8}
${'boolean'} | ${true}
${'boolean'} | ${false}
`('with value of type "$fieldType"', ({ fieldType, value }) => {
const createWrapper = () => {
return shallowMount(Text, {
propsData: {
......@@ -29,8 +29,8 @@ describe('ee/vulnerabilities/components/generic_report/types/value.vue', () => {
wrapper.destroy();
});
it(`renders "${printValue}"`, () => {
expect(wrapper.text()).toBe(printValue);
it(`renders ${fieldType} type`, () => {
expect(wrapper.text()).toBe(value.toString());
});
});
});
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