2022-08-13 15:12:31 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-07-31 22:56:46 +05:30
|
|
|
import { FIXTURES_PATH } from 'spec/test_constants';
|
2020-01-01 13:55:28 +05:30
|
|
|
import PDFLab from '~/pdf/index.vue';
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
describe('PDFLab component', () => {
|
|
|
|
let wrapper;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
const mountComponent = ({ pdf }) => shallowMount(PDFLab, { propsData: { pdf } });
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
describe('without PDF data', () => {
|
2022-07-16 23:28:13 +05:30
|
|
|
beforeEach(() => {
|
2022-08-13 15:12:31 +05:30
|
|
|
wrapper = mountComponent({ pdf: '' });
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render', () => {
|
2022-08-13 15:12:31 +05:30
|
|
|
expect(wrapper.isVisible()).toBe(false);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with PDF data', () => {
|
2022-07-16 23:28:13 +05:30
|
|
|
beforeEach(() => {
|
2022-08-13 15:12:31 +05:30
|
|
|
wrapper = mountComponent({ pdf: `${FIXTURES_PATH}/blob/pdf/test.pdf` });
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
it('renders', () => {
|
|
|
|
expect(wrapper.isVisible()).toBe(true);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|