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 mountComponent from 'helpers/vue_mount_component_helper';
import { mount } from '@vue/test-utils';
import FileRowStats from '~/diffs/components/file_row_stats.vue';
describe('Diff file row stats', () => {
let Component;
let vm;
beforeAll(() => {
Component = Vue.extend(FileRowStats);
});
beforeEach(() => {
vm = mountComponent(Component, {
const wrapper = mount(FileRowStats, {
propsData: {
file: {
addedLines: 20,
removedLines: 10,
},
});
});
afterEach(() => {
vm.$destroy();
},
});
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', () => {
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