Commit c4df771f authored by Clement Ho's avatar Clement Ho

Merge branch 'add-missing-gapi-mock' into 'master'

Add missing window.gapi mock

See merge request gitlab-org/gitlab!16688
parents 9b93822f 44bb7aef
......@@ -4,6 +4,7 @@ import { createStore } from '~/create_cluster/gke_cluster/store';
import { SET_PROJECTS } from '~/create_cluster/gke_cluster/store/mutation_types';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { emptyProjectMock, selectedProjectMock } from '../mock_data';
import { gapi } from '../helpers';
const componentConfig = {
docsUrl: 'https://console.cloud.google.com/home/dashboard',
......@@ -32,6 +33,16 @@ describe('GkeProjectIdDropdown', () => {
let vm;
let store;
let originalGapi;
beforeAll(() => {
originalGapi = window.gapi;
window.gapi = gapi();
});
afterAll(() => {
window.gapi = originalGapi;
});
beforeEach(() => {
store = createStore();
vm = createComponent(store);
......
......@@ -64,7 +64,15 @@ describe('GCP Cluster Dropdown Store Actions', () => {
});
describe('async fetch methods', () => {
window.gapi = gapi();
let originalGapi;
beforeAll(() => {
originalGapi = window.gapi;
window.gapi = gapi();
});
afterAll(() => {
window.gapi = originalGapi;
});
describe('fetchProjects', () => {
it('fetches projects from Google API', done => {
......
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