Commit 083e896d authored by Luke Bennett's avatar Luke Bennett Committed by Luke Bennett

Fix unmocked requests in serverless tests

parent 97b8853d
......@@ -67,7 +67,7 @@ describe('Area component', () => {
const mockWidth = 233;
beforeEach(() => {
spyOn(Element.prototype, 'getBoundingClientRect').and.callFake(() => ({
jest.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(() => ({
width: mockWidth,
}));
areaChart.vm.onResize();
......
......@@ -3,7 +3,8 @@ import { shallowMount } from '@vue/test-utils';
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', () => {
it('Parses the function details correctly', () => {
......
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 { createLocalVue, shallowMount } from '@vue/test-utils';
import { createStore } from '~/serverless/store';
......@@ -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, {
localVue,
store,
propsData: {
installed: true,
clustersPath: '',
helpPath: '',
statusPath: '',
clustersPath: 'clustersPath',
helpPath: 'helpPath',
statusPath,
},
sync: false,
});
......
......@@ -32,7 +32,9 @@ describe('ServerlessActions', () => {
it('should successfully retry', done => {
const endpoint = '/functions';
const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.NO_CONTENT);
mock
.onGet(endpoint)
.reply(() => new Promise(resolve => setTimeout(() => resolve(200), Infinity)));
testAction(
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