Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-16 09:09:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-16 09:09:39 +0300
commit1ab35c9208287638a097abc895738fbc0c0860e6 (patch)
tree4ab489a19f051aa1278030b7efa7befeb60ce194 /spec/javascripts
parent7a5662b39bf5d80937dcc5a84a76ce15ff88cce7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/monitoring/components/dashboard_resize_spec.js61
-rw-r--r--spec/javascripts/monitoring/fixture_data.js1
-rw-r--r--spec/javascripts/monitoring/store_utils.js1
-rw-r--r--spec/javascripts/sidebar/sidebar_assignees_spec.js64
4 files changed, 6 insertions, 121 deletions
diff --git a/spec/javascripts/monitoring/components/dashboard_resize_spec.js b/spec/javascripts/monitoring/components/dashboard_resize_spec.js
index 6455346e890..0c3193940e6 100644
--- a/spec/javascripts/monitoring/components/dashboard_resize_spec.js
+++ b/spec/javascripts/monitoring/components/dashboard_resize_spec.js
@@ -2,66 +2,13 @@ import Vue from 'vue';
import { createLocalVue } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import Dashboard from '~/monitoring/components/dashboard.vue';
-import * as types from '~/monitoring/stores/mutation_types';
import { createStore } from '~/monitoring/stores';
import axios from '~/lib/utils/axios_utils';
-import {
- metricsDashboardPayload,
- mockedEmptyResult,
- mockedQueryResultPayload,
- mockedQueryResultPayloadCoresTotal,
- mockApiEndpoint,
- environmentData,
-} from '../mock_data';
+import { mockApiEndpoint, propsData } from '../mock_data';
+import { metricsDashboardPayload } from '../fixture_data';
+import { setupStoreWithData } from '../store_utils';
const localVue = createLocalVue();
-const propsData = {
- hasMetrics: false,
- documentationPath: '/path/to/docs',
- settingsPath: '/path/to/settings',
- clustersPath: '/path/to/clusters',
- tagsPath: '/path/to/tags',
- projectPath: '/path/to/project',
- defaultBranch: 'master',
- metricsEndpoint: mockApiEndpoint,
- deploymentsEndpoint: null,
- emptyGettingStartedSvgPath: '/path/to/getting-started.svg',
- emptyLoadingSvgPath: '/path/to/loading.svg',
- emptyNoDataSvgPath: '/path/to/no-data.svg',
- emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg',
- emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg',
- currentEnvironmentName: 'production',
- customMetricsAvailable: false,
- customMetricsPath: '',
- validateQueryPath: '',
-};
-
-function setupComponentStore(component) {
- // Load 2 panel groups
- component.$store.commit(
- `monitoringDashboard/${types.RECEIVE_METRICS_DASHBOARD_SUCCESS}`,
- metricsDashboardPayload,
- );
-
- // Load 3 panels to the dashboard, one with an empty result
- component.$store.commit(
- `monitoringDashboard/${types.RECEIVE_METRIC_RESULT_SUCCESS}`,
- mockedEmptyResult,
- );
- component.$store.commit(
- `monitoringDashboard/${types.RECEIVE_METRIC_RESULT_SUCCESS}`,
- mockedQueryResultPayload,
- );
- component.$store.commit(
- `monitoringDashboard/${types.RECEIVE_METRIC_RESULT_SUCCESS}`,
- mockedQueryResultPayloadCoresTotal,
- );
-
- component.$store.commit(
- `monitoringDashboard/${types.RECEIVE_ENVIRONMENTS_DATA_SUCCESS}`,
- environmentData,
- );
-}
describe('Dashboard', () => {
let DashboardComponent;
@@ -109,7 +56,7 @@ describe('Dashboard', () => {
store,
});
- setupComponentStore(component);
+ setupStoreWithData(component.$store);
return Vue.nextTick().then(() => {
[promPanel] = component.$el.querySelectorAll('.prometheus-panel');
diff --git a/spec/javascripts/monitoring/fixture_data.js b/spec/javascripts/monitoring/fixture_data.js
new file mode 100644
index 00000000000..1375c27cdde
--- /dev/null
+++ b/spec/javascripts/monitoring/fixture_data.js
@@ -0,0 +1 @@
+export * from '../../frontend/monitoring/fixture_data';
diff --git a/spec/javascripts/monitoring/store_utils.js b/spec/javascripts/monitoring/store_utils.js
new file mode 100644
index 00000000000..1222716c829
--- /dev/null
+++ b/spec/javascripts/monitoring/store_utils.js
@@ -0,0 +1 @@
+export * from '../../frontend/monitoring/store_utils';
diff --git a/spec/javascripts/sidebar/sidebar_assignees_spec.js b/spec/javascripts/sidebar/sidebar_assignees_spec.js
deleted file mode 100644
index 23b8dc69925..00000000000
--- a/spec/javascripts/sidebar/sidebar_assignees_spec.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import Vue from 'vue';
-import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import SidebarAssignees from '~/sidebar/components/assignees/sidebar_assignees.vue';
-import SidebarMediator from '~/sidebar/sidebar_mediator';
-import SidebarService from '~/sidebar/services/sidebar_service';
-import SidebarStore from '~/sidebar/stores/sidebar_store';
-import Mock from './mock_data';
-
-describe('sidebar assignees', () => {
- let vm;
- let mediator;
- let sidebarAssigneesEl;
- preloadFixtures('issues/open-issue.html');
-
- beforeEach(() => {
- loadFixtures('issues/open-issue.html');
-
- mediator = new SidebarMediator(Mock.mediator);
- spyOn(mediator, 'saveAssignees').and.callThrough();
- spyOn(mediator, 'assignYourself').and.callThrough();
-
- const SidebarAssigneeComponent = Vue.extend(SidebarAssignees);
- sidebarAssigneesEl = document.querySelector('#js-vue-sidebar-assignees');
- vm = mountComponent(
- SidebarAssigneeComponent,
- {
- mediator,
- field: sidebarAssigneesEl.dataset.field,
- },
- sidebarAssigneesEl,
- );
- });
-
- afterEach(() => {
- SidebarService.singleton = null;
- SidebarStore.singleton = null;
- SidebarMediator.singleton = null;
- });
-
- it('calls the mediator when saves the assignees', () => {
- vm.saveAssignees();
-
- expect(mediator.saveAssignees).toHaveBeenCalled();
- });
-
- it('calls the mediator when "assignSelf" method is called', () => {
- vm.assignSelf();
-
- expect(mediator.assignYourself).toHaveBeenCalled();
- expect(mediator.store.assignees.length).toEqual(1);
- });
-
- it('hides assignees until fetched', done => {
- const currentAssignee = sidebarAssigneesEl.querySelector('.value');
-
- expect(currentAssignee).toBe(null);
-
- vm.store.isFetching.assignees = false;
- Vue.nextTick(() => {
- expect(vm.$el.querySelector('.value')).toBeVisible();
- done();
- });
- });
-});