debian-mirror-gitlab/spec/frontend/issuable_show/components/issuable_description_spec.js
2021-03-11 19:13:27 +05:30

41 lines
938 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import $ from 'jquery';
import IssuableDescription from '~/issuable_show/components/issuable_description.vue';
import { mockIssuable } from '../mock_data';
const createComponent = (issuable = mockIssuable) =>
shallowMount(IssuableDescription, {
propsData: { issuable },
});
describe('IssuableDescription', () => {
let renderGFMSpy;
let wrapper;
beforeEach(() => {
renderGFMSpy = jest.spyOn($.fn, 'renderGFM');
wrapper = createComponent();
});
afterEach(() => {
wrapper.destroy();
});
describe('mounted', () => {
it('calls `renderGFM`', () => {
expect(renderGFMSpy).toHaveBeenCalledTimes(1);
});
});
describe('methods', () => {
describe('renderGFM', () => {
it('calls `renderGFM` on container element', () => {
wrapper.vm.renderGFM();
expect(renderGFMSpy).toHaveBeenCalled();
});
});
});
});