Commit 3773047e authored by Illya Klymov's avatar Illya Klymov

Merge branch 'jdb/refactor-mount-component-file-row-stats' into 'master'

Refactor mountComponent to mount in file_row_stats_spec.js

See merge request gitlab-org/gitlab!50672
parents 833a3558 7515b6c9
import Vue from 'vue'; import { mount } from '@vue/test-utils';
import mountComponent from 'helpers/vue_mount_component_helper';
import FileRowStats from '~/diffs/components/file_row_stats.vue'; import FileRowStats from '~/diffs/components/file_row_stats.vue';
describe('Diff file row stats', () => { describe('Diff file row stats', () => {
let Component; const wrapper = mount(FileRowStats, {
let vm; propsData: {
beforeAll(() => {
Component = Vue.extend(FileRowStats);
});
beforeEach(() => {
vm = mountComponent(Component, {
file: { file: {
addedLines: 20, addedLines: 20,
removedLines: 10, removedLines: 10,
}, },
}); },
});
afterEach(() => {
vm.$destroy();
}); });
it('renders added lines count', () => { it('renders added lines count', () => {
expect(vm.$el.querySelector('.cgreen').textContent).toContain('+20'); expect(wrapper.find('.cgreen').text()).toContain('+20');
}); });
it('renders removed lines count', () => { it('renders removed lines count', () => {
expect(vm.$el.querySelector('.cred').textContent).toContain('-10'); expect(wrapper.find('.cred').text()).toContain('-10');
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment