summaryrefslogtreecommitdiff
path: root/spec/javascripts/diffs/components/file_row_stats_spec.js
blob: a8a7f3f1d821e649fc0fcf05463751bbf9c8026f (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 FileRowStats from '~/diffs/components/file_row_stats.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';

describe('Diff file row stats', () => {
  let Component;
  let vm;

  beforeAll(() => {
    Component = Vue.extend(FileRowStats);
  });

  beforeEach(() => {
    vm = mountComponent(Component, {
      file: {
        addedLines: 20,
        removedLines: 10,
      },
    });
  });

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

  it('renders added lines count', () => {
    expect(vm.$el.querySelector('.cgreen').textContent).toContain('+20');
  });

  it('renders removed lines count', () => {
    expect(vm.$el.querySelector('.cred').textContent).toContain('-10');
  });
});