Commit 7dcccba4 authored by Luke Bennett's avatar Luke Bennett Committed by Luke Bennett

Fix unmocked requests in serverless tests

parent 0441a2e3
...@@ -67,7 +67,7 @@ describe('Area component', () => { ...@@ -67,7 +67,7 @@ describe('Area component', () => {
const mockWidth = 233; const mockWidth = 233;
beforeEach(() => { beforeEach(() => {
spyOn(Element.prototype, 'getBoundingClientRect').and.callFake(() => ({ jest.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(() => ({
width: mockWidth, width: mockWidth,
})); }));
areaChart.vm.onResize(); areaChart.vm.onResize();
......
...@@ -3,7 +3,8 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,8 @@ import { shallowMount } from '@vue/test-utils';
import { mockServerlessFunction } from '../mock_data'; import { mockServerlessFunction } from '../mock_data';
const createComponent = func => shallowMount(functionRowComponent, { propsData: { func } }).vm; const createComponent = func =>
shallowMount(functionRowComponent, { propsData: { func }, sync: false }).vm;
describe('functionRowComponent', () => { describe('functionRowComponent', () => {
it('Parses the function details correctly', () => { it('Parses the function details correctly', () => {
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import AxiosMockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import functionsComponent from '~/serverless/components/functions.vue'; import functionsComponent from '~/serverless/components/functions.vue';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { createStore } from '~/serverless/store'; import { createStore } from '~/serverless/store';
...@@ -79,15 +80,19 @@ describe('functionsComponent', () => { ...@@ -79,15 +80,19 @@ describe('functionsComponent', () => {
); );
}); });
it('should render the functions list', () => { fit('should render the functions list', () => {
const statusPath = 'statusPath';
const axiosMock = new AxiosMockAdapter(axios);
axiosMock.onGet(statusPath).reply(200);
component = shallowMount(functionsComponent, { component = shallowMount(functionsComponent, {
localVue, localVue,
store, store,
propsData: { propsData: {
installed: true, installed: true,
clustersPath: '', clustersPath: 'clustersPath',
helpPath: '', helpPath: 'helpPath',
statusPath: '', statusPath,
}, },
sync: false, sync: false,
}); });
......
...@@ -32,7 +32,9 @@ describe('ServerlessActions', () => { ...@@ -32,7 +32,9 @@ describe('ServerlessActions', () => {
it('should successfully retry', done => { it('should successfully retry', done => {
const endpoint = '/functions'; const endpoint = '/functions';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.NO_CONTENT); mock
.onGet(endpoint)
.reply(() => new Promise(resolve => setTimeout(() => resolve(200), Infinity)));
testAction( testAction(
fetchFunctions, fetchFunctions,
......
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