Welcome to mirror list, hosted at ThFree Co, Russian Federation.

parallel_diff_view_spec.js « components « diffs « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30231f0ba710efc5bac1a0ee77db83b26710b871 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Vue from 'vue';
import { createStore } from '~/mr_notes/stores';
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import ParallelDiffView from '~/diffs/components/parallel_diff_view.vue';
import * as constants from '~/diffs/constants';
import diffFileMockData from '../mock_data/diff_file';

describe('ParallelDiffView', () => {
  let component;
  const getDiffFileMock = () => ({ ...diffFileMockData });

  beforeEach(() => {
    const diffFile = getDiffFileMock();

    component = createComponentWithStore(Vue.extend(ParallelDiffView), createStore(), {
      diffFile,
      diffLines: diffFile.parallel_diff_lines,
    }).$mount();
  });

  afterEach(() => {
    component.$destroy();
  });

  describe('assigned', () => {
    describe('diffLines', () => {
      it('should normalize lines for empty cells', () => {
        expect(component.diffLines[0].left.type).toEqual(constants.EMPTY_CELL_TYPE);
        expect(component.diffLines[1].left.type).toEqual(constants.EMPTY_CELL_TYPE);
      });
    });
  });
});