diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-16 00:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-16 00:09:26 +0300 |
commit | 651917dbac09fc4fe9217c08d68420019dff59fb (patch) | |
tree | 6cdda4532d41b7862a33d7f3ab91959c3917d4f0 /spec/frontend/monitoring/components/dashboard_spec.js | |
parent | da1962d9ac710f95d350d2645c87f5a663123cf2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/monitoring/components/dashboard_spec.js')
-rw-r--r-- | spec/frontend/monitoring/components/dashboard_spec.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js index 614b7a0fd6a..4b7f7a9ddb3 100644 --- a/spec/frontend/monitoring/components/dashboard_spec.js +++ b/spec/frontend/monitoring/components/dashboard_spec.js @@ -433,6 +433,10 @@ describe('Dashboard', () => { const findDashboardDropdown = () => wrapper.find(DashboardHeader).find(DashboardsDropdown); beforeEach(() => { + store.commit(`monitoringDashboard/${types.SET_INITIAL_STATE}`, { + projectPath: TEST_HOST, + }); + delete window.location; window.location = { ...windowLocation, assign: jest.fn() }; createMountedWrapper(); @@ -446,10 +450,11 @@ describe('Dashboard', () => { it('encodes dashboard param', () => { findDashboardDropdown().vm.$emit('selectDashboard', { - path: 'dashboard©.yml', + path: '.gitlab/dashboards/dashboard©.yml', + display_name: 'dashboard©.yml', }); expect(window.location.assign).toHaveBeenCalledWith( - `${TEST_HOST}/?dashboard=dashboard%2526copy.yml`, + `${TEST_HOST}/-/metrics/dashboard%26copy.yml`, ); }); }); @@ -486,6 +491,8 @@ describe('Dashboard', () => { beforeEach(() => { store.commit(`monitoringDashboard/${types.SET_INITIAL_STATE}`, { currentEnvironmentName: 'production', + currentDashboard: dashboardGitResponse[0].path, + projectPath: TEST_HOST, }); createMountedWrapper({ hasMetrics: true }); setupStoreWithData(store); @@ -498,9 +505,12 @@ describe('Dashboard', () => { findAllEnvironmentsDropdownItems().wrappers.forEach((itemWrapper, index) => { const anchorEl = itemWrapper.find('a'); - if (anchorEl.exists() && environmentData[index].metrics_path) { + if (anchorEl.exists()) { const href = anchorEl.attributes('href'); - expect(href).toBe(environmentData[index].metrics_path); + const currentDashboard = encodeURIComponent(dashboardGitResponse[0].path); + const environmentId = encodeURIComponent(environmentData[index].id); + const url = `${TEST_HOST}/-/metrics/${currentDashboard}?environment=${environmentId}`; + expect(href).toBe(url); } }); }); |