diff options
author | Kushal Pandya <kushalspandya@gmail.com> | 2019-04-08 04:08:32 +0000 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2019-04-08 04:08:32 +0000 |
commit | 6b8f6075b785ae91d3319ab19361f04ab2ade9b9 (patch) | |
tree | 505e5e6b9815e4b6df5551d8bde05123a2ed5cb7 /spec | |
parent | 5d1e2a7a42bcc5d78da610f5a37d1e99500da889 (diff) | |
parent | 2daba22b12ab1a94bf6643ab201ff6eeac2fe05f (diff) | |
download | gitlab-ce-6b8f6075b785ae91d3319ab19361f04ab2ade9b9.tar.gz |
Merge branch 'fix-karma-test-utils-master-overflow' into 'master'
CE Move serverless karma specs to jest
Closes #60154
See merge request gitlab-org/gitlab-ce!27085
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/serverless/components/area_spec.js (renamed from spec/javascripts/serverless/components/area_spec.js) | 3 | ||||
-rw-r--r-- | spec/frontend/serverless/components/environment_row_spec.js (renamed from spec/javascripts/serverless/components/environment_row_spec.js) | 2 | ||||
-rw-r--r-- | spec/frontend/serverless/components/function_details_spec.js (renamed from spec/javascripts/serverless/components/function_details_spec.js) | 4 | ||||
-rw-r--r-- | spec/frontend/serverless/components/function_row_spec.js (renamed from spec/javascripts/serverless/components/function_row_spec.js) | 3 | ||||
-rw-r--r-- | spec/frontend/serverless/components/functions_spec.js (renamed from spec/javascripts/serverless/components/functions_spec.js) | 15 | ||||
-rw-r--r-- | spec/frontend/serverless/components/missing_prometheus_spec.js (renamed from spec/javascripts/serverless/components/missing_prometheus_spec.js) | 1 | ||||
-rw-r--r-- | spec/frontend/serverless/components/pod_box_spec.js (renamed from spec/javascripts/serverless/components/pod_box_spec.js) | 1 | ||||
-rw-r--r-- | spec/frontend/serverless/components/url_spec.js (renamed from spec/javascripts/serverless/components/url_spec.js) | 1 | ||||
-rw-r--r-- | spec/frontend/serverless/mock_data.js (renamed from spec/javascripts/serverless/mock_data.js) | 0 | ||||
-rw-r--r-- | spec/frontend/serverless/store/actions_spec.js (renamed from spec/javascripts/serverless/store/actions_spec.js) | 4 | ||||
-rw-r--r-- | spec/frontend/serverless/store/getters_spec.js (renamed from spec/javascripts/serverless/store/getters_spec.js) | 0 | ||||
-rw-r--r-- | spec/frontend/serverless/store/mutations_spec.js (renamed from spec/javascripts/serverless/store/mutations_spec.js) | 0 | ||||
-rw-r--r-- | spec/frontend/serverless/utils.js (renamed from spec/javascripts/serverless/utils.js) | 0 |
13 files changed, 25 insertions, 9 deletions
diff --git a/spec/javascripts/serverless/components/area_spec.js b/spec/frontend/serverless/components/area_spec.js index 2be6ac3d268..62005e1981a 100644 --- a/spec/javascripts/serverless/components/area_spec.js +++ b/spec/frontend/serverless/components/area_spec.js @@ -16,6 +16,7 @@ describe('Area component', () => { slots: { default: mockWidgets, }, + sync: false, }); }); @@ -67,7 +68,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(); diff --git a/spec/javascripts/serverless/components/environment_row_spec.js b/spec/frontend/serverless/components/environment_row_spec.js index 932d712dbec..161a637dd75 100644 --- a/spec/javascripts/serverless/components/environment_row_spec.js +++ b/spec/frontend/serverless/components/environment_row_spec.js @@ -5,7 +5,7 @@ import { mockServerlessFunctions, mockServerlessFunctionsDiffEnv } from '../mock import { translate } from '~/serverless/utils'; const createComponent = (localVue, env, envName) => - shallowMount(environmentRowComponent, { localVue, propsData: { env, envName } }).vm; + shallowMount(environmentRowComponent, { localVue, propsData: { env, envName }, sync: false }).vm; describe('environment row component', () => { describe('default global cluster case', () => { diff --git a/spec/javascripts/serverless/components/function_details_spec.js b/spec/frontend/serverless/components/function_details_spec.js index a29d4a296ef..31348ff1194 100644 --- a/spec/javascripts/serverless/components/function_details_spec.js +++ b/spec/frontend/serverless/components/function_details_spec.js @@ -41,6 +41,7 @@ describe('functionDetailsComponent', () => { clustersPath: '/clusters', helpPath: '/help', }, + sync: false, }); expect( @@ -68,6 +69,7 @@ describe('functionDetailsComponent', () => { clustersPath: '/clusters', helpPath: '/help', }, + sync: false, }); expect(component.vm.$el.querySelector('p').innerHTML.trim()).toContain('1 pod in use'); @@ -85,6 +87,7 @@ describe('functionDetailsComponent', () => { clustersPath: '/clusters', helpPath: '/help', }, + sync: false, }); expect(component.vm.$el.querySelector('p').innerHTML.trim()).toContain('3 pods in use'); @@ -102,6 +105,7 @@ describe('functionDetailsComponent', () => { clustersPath: '/clusters', helpPath: '/help', }, + sync: false, }); expect( diff --git a/spec/javascripts/serverless/components/function_row_spec.js b/spec/frontend/serverless/components/function_row_spec.js index 3987e1753bd..414fdc5cd82 100644 --- a/spec/javascripts/serverless/components/function_row_spec.js +++ b/spec/frontend/serverless/components/function_row_spec.js @@ -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', () => { diff --git a/spec/javascripts/serverless/components/functions_spec.js b/spec/frontend/serverless/components/functions_spec.js index c32978ea58a..5533de1a70a 100644 --- a/spec/javascripts/serverless/components/functions_spec.js +++ b/spec/frontend/serverless/components/functions_spec.js @@ -1,5 +1,6 @@ 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, }); diff --git a/spec/javascripts/serverless/components/missing_prometheus_spec.js b/spec/frontend/serverless/components/missing_prometheus_spec.js index 77aca03772b..d0df6125290 100644 --- a/spec/javascripts/serverless/components/missing_prometheus_spec.js +++ b/spec/frontend/serverless/components/missing_prometheus_spec.js @@ -8,6 +8,7 @@ const createComponent = missingData => helpPath: '/help', missingData, }, + sync: false, }).vm; describe('missingPrometheusComponent', () => { diff --git a/spec/javascripts/serverless/components/pod_box_spec.js b/spec/frontend/serverless/components/pod_box_spec.js index 69ac1a2bb5f..d82825d8f62 100644 --- a/spec/javascripts/serverless/components/pod_box_spec.js +++ b/spec/frontend/serverless/components/pod_box_spec.js @@ -6,6 +6,7 @@ const createComponent = count => propsData: { count, }, + sync: false, }).vm; describe('podBoxComponent', () => { diff --git a/spec/javascripts/serverless/components/url_spec.js b/spec/frontend/serverless/components/url_spec.js index 08c3e4146b1..d05a9bba103 100644 --- a/spec/javascripts/serverless/components/url_spec.js +++ b/spec/frontend/serverless/components/url_spec.js @@ -7,6 +7,7 @@ const createComponent = uri => propsData: { uri, }, + sync: false, }).vm; describe('urlComponent', () => { diff --git a/spec/javascripts/serverless/mock_data.js b/spec/frontend/serverless/mock_data.js index a2c18616324..a2c18616324 100644 --- a/spec/javascripts/serverless/mock_data.js +++ b/spec/frontend/serverless/mock_data.js diff --git a/spec/javascripts/serverless/store/actions_spec.js b/spec/frontend/serverless/store/actions_spec.js index 602798573e9..aac57c75a4f 100644 --- a/spec/javascripts/serverless/store/actions_spec.js +++ b/spec/frontend/serverless/store/actions_spec.js @@ -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, diff --git a/spec/javascripts/serverless/store/getters_spec.js b/spec/frontend/serverless/store/getters_spec.js index fb549c8f153..fb549c8f153 100644 --- a/spec/javascripts/serverless/store/getters_spec.js +++ b/spec/frontend/serverless/store/getters_spec.js diff --git a/spec/javascripts/serverless/store/mutations_spec.js b/spec/frontend/serverless/store/mutations_spec.js index ca3053e5c38..ca3053e5c38 100644 --- a/spec/javascripts/serverless/store/mutations_spec.js +++ b/spec/frontend/serverless/store/mutations_spec.js diff --git a/spec/javascripts/serverless/utils.js b/spec/frontend/serverless/utils.js index 5ce2e37d493..5ce2e37d493 100644 --- a/spec/javascripts/serverless/utils.js +++ b/spec/frontend/serverless/utils.js |