Commit bf0f5ac9 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch...

Merge branch 'migrate_ee_spec_javascripts_vue_mr_widget_components_performance_issue_body_spec' into 'master'

Migrate ee performance_issue_body_spec to Jest

See merge request gitlab-org/gitlab!30452
parents 88ab2386 7d69c8e5
import Vue from 'vue'; import { shallowMount } from '@vue/test-utils';
import component from 'ee/vue_merge_request_widget/components/performance_issue_body.vue'; import component from 'ee/vue_merge_request_widget/components/performance_issue_body.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('performance issue body', () => { describe('performance issue body', () => {
let vm; let wrapper;
const Component = Vue.extend(component);
const performanceIssue = { const performanceIssue = {
delta: 0.1999999999998181, delta: 0.1999999999998181,
...@@ -14,25 +11,28 @@ describe('performance issue body', () => { ...@@ -14,25 +11,28 @@ describe('performance issue body', () => {
score: 4974.8, score: 4974.8,
}; };
afterEach(() => {
vm.$destroy();
});
beforeEach(() => { beforeEach(() => {
vm = mountComponent(Component, { wrapper = shallowMount(component, {
issue: performanceIssue, propsData: {
issue: performanceIssue,
},
}); });
}); });
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it('renders issue name', () => { it('renders issue name', () => {
expect(vm.$el.textContent.trim()).toContain(performanceIssue.name); expect(wrapper.text()).toContain(performanceIssue.name);
}); });
it('renders issue score formatted', () => { it('renders issue score formatted', () => {
expect(vm.$el.textContent.trim()).toContain('4974.80'); expect(wrapper.text()).toContain('4974.80');
}); });
it('renders issue delta formatted', () => { it('renders issue delta formatted', () => {
expect(vm.$el.textContent.trim()).toContain('(+0.20)'); expect(wrapper.text()).toContain('(+0.20)');
}); });
}); });
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