2018-06-21 08:22:40 -04:00
|
|
|
import Vue from 'vue';
|
2020-03-20 11:09:17 -04:00
|
|
|
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
|
2020-08-17 17:09:56 -04:00
|
|
|
import { createStore } from '~/mr_notes/stores';
|
2019-12-09 07:07:58 -05:00
|
|
|
import ParallelDiffView from '~/diffs/components/parallel_diff_view.vue';
|
|
|
|
import * as constants from '~/diffs/constants';
|
2018-06-21 08:22:40 -04:00
|
|
|
import diffFileMockData from '../mock_data/diff_file';
|
|
|
|
|
|
|
|
describe('ParallelDiffView', () => {
|
|
|
|
let component;
|
2020-05-07 17:09:26 -04:00
|
|
|
const getDiffFileMock = () => ({ ...diffFileMockData });
|
2018-06-21 08:22:40 -04:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const diffFile = getDiffFileMock();
|
|
|
|
|
2019-08-11 19:57:30 -04:00
|
|
|
component = createComponentWithStore(Vue.extend(ParallelDiffView), createStore(), {
|
2018-06-21 08:22:40 -04:00
|
|
|
diffFile,
|
2018-11-09 14:48:41 -05:00
|
|
|
diffLines: diffFile.parallel_diff_lines,
|
2018-06-21 08:22:40 -04:00
|
|
|
}).$mount();
|
|
|
|
});
|
|
|
|
|
2019-03-04 06:27:57 -05:00
|
|
|
afterEach(() => {
|
|
|
|
component.$destroy();
|
|
|
|
});
|
|
|
|
|
2018-09-03 03:44:46 -04:00
|
|
|
describe('assigned', () => {
|
|
|
|
describe('diffLines', () => {
|
2018-06-21 08:22:40 -04:00
|
|
|
it('should normalize lines for empty cells', () => {
|
2018-09-03 03:44:46 -04:00
|
|
|
expect(component.diffLines[0].left.type).toEqual(constants.EMPTY_CELL_TYPE);
|
|
|
|
expect(component.diffLines[1].left.type).toEqual(constants.EMPTY_CELL_TYPE);
|
2018-06-21 08:22:40 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|