debian-mirror-gitlab/spec/frontend/diffs/components/parallel_diff_view_spec.js

38 lines
898 B
JavaScript
Raw Normal View History

2020-11-24 15:15:51 +05:30
import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils';
2020-10-24 23:57:45 +05:30
import { createStore } from '~/mr_notes/stores';
2020-01-01 13:55:28 +05:30
import ParallelDiffView from '~/diffs/components/parallel_diff_view.vue';
2020-11-24 15:15:51 +05:30
import parallelDiffTableRow from '~/diffs/components/parallel_diff_table_row.vue';
2018-11-08 19:23:39 +05:30
import diffFileMockData from '../mock_data/diff_file';
2020-11-24 15:15:51 +05:30
let wrapper;
const localVue = createLocalVue();
localVue.use(Vuex);
2018-11-08 19:23:39 +05:30
2020-11-24 15:15:51 +05:30
function factory() {
const diffFile = { ...diffFileMockData };
const store = createStore();
2018-11-08 19:23:39 +05:30
2020-11-24 15:15:51 +05:30
wrapper = shallowMount(ParallelDiffView, {
localVue,
store,
propsData: {
2018-11-08 19:23:39 +05:30
diffFile,
2019-02-15 15:39:39 +05:30
diffLines: diffFile.parallel_diff_lines,
2020-11-24 15:15:51 +05:30
},
2018-11-08 19:23:39 +05:30
});
2020-11-24 15:15:51 +05:30
}
2018-11-08 19:23:39 +05:30
2020-11-24 15:15:51 +05:30
describe('ParallelDiffView', () => {
2019-07-07 11:18:12 +05:30
afterEach(() => {
2020-11-24 15:15:51 +05:30
wrapper.destroy();
2019-07-07 11:18:12 +05:30
});
2020-11-24 15:15:51 +05:30
it('renders diff lines', () => {
factory();
expect(wrapper.findAll(parallelDiffTableRow).length).toBe(8);
2018-11-08 19:23:39 +05:30
});
});