Commit 1e00a8a8 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch '8265-ops-dashboard-intermittent-dashboard-component-karma-failure' into 'master'

Resolve "Ops Dashboard intermittent dashboard component karma failure"

Closes #8265

See merge request gitlab-org/gitlab-ee!8215
parents 2833cc18 4afbb99d
import Vue from 'vue'; import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import store from 'ee/operations/store/index'; import store from 'ee/operations/store/index';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import Dashboard from 'ee/operations/components/dashboard/dashboard.vue'; import Dashboard from 'ee/operations/components/dashboard/dashboard.vue';
...@@ -12,24 +14,28 @@ describe('dashboard component', () => { ...@@ -12,24 +14,28 @@ describe('dashboard component', () => {
const ProjectSearchComponent = Vue.extend(ProjectSearch); const ProjectSearchComponent = Vue.extend(ProjectSearch);
const DashboardProjectComponent = Vue.extend(DashboardProject); const DashboardProjectComponent = Vue.extend(DashboardProject);
const projectTokens = mockProjectData(1); const projectTokens = mockProjectData(1);
const mockListPath = 'mock-listPath';
const mount = () => const mount = () =>
mountComponentWithStore(DashboardComponent, { mountComponentWithStore(DashboardComponent, {
store, store,
props: { props: {
addPath: 'mock-addPath', addPath: 'mock-addPath',
listPath: 'mock-listPath', listPath: mockListPath,
emptyDashboardSvgPath: '/assets/illustrations/operations-dashboard_empty.svg', emptyDashboardSvgPath: '/assets/illustrations/operations-dashboard_empty.svg',
}, },
}); });
let vm; let vm;
let mockAxios;
beforeEach(() => { beforeEach(() => {
vm = mount(); vm = mount();
mockAxios = new MockAdapter(axios);
}); });
afterEach(() => { afterEach(() => {
vm.$destroy(); vm.$destroy();
clearState(store); clearState(store);
mockAxios.restore();
}); });
it('renders dashboard title', () => { it('renders dashboard title', () => {
...@@ -94,11 +100,9 @@ describe('dashboard component', () => { ...@@ -94,11 +100,9 @@ describe('dashboard component', () => {
}); });
describe('empty state', () => { describe('empty state', () => {
beforeAll(done => { beforeEach(() => {
vm.$store mockAxios.onGet(mockListPath).replyOnce(200, { data: [] });
.dispatch('requestProjects') vm = mount();
.then(() => vm.$nextTick(done))
.catch(done.fail);
}); });
it('renders empty state svg after requesting projects with no results', () => { it('renders empty state svg after requesting projects with no results', () => {
......
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