Commit 77336b01 authored by Dave Pisek's avatar Dave Pisek

Add specs for "code" component

parent fadd6e5e
import { GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Code from 'ee/vulnerabilities/components/generic_report/types/code.vue';
import CodeBlock from '~/vue_shared/components/code_block.vue';
const TEST_DATA = {
value: '<h1>Foo</h1>',
};
describe('ee/vulnerabilities/components/generic_report/types/code.vue', () => {
let wrapper;
const createWrapper = () => {
return shallowMount(Code, {
propsData: {
...TEST_DATA,
},
});
};
const findCodeBlock = () => wrapper.findComponent(CodeBlock);
beforeEach(() => {
wrapper = createWrapper();
});
afterEach(() => {
wrapper.destroy();
});
it('renders a code-block', () => {
expect(findCodeBlock().exists()).toBe(true);
});
it('passes the given value to the code-block component', () => {
expect(findCodeBlock().props('code')).toBe(TEST_DATA.value);
});
});
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