Commit 7515b6c9 authored by jboyson's avatar jboyson

Refactor mountComponent to mount

Part of the epic https://gitlab.com/groups/gitlab-org/-/epics/5102
parent 4ca69686
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