diff options
Diffstat (limited to 'spec/frontend/monitoring/components/dashboard_spec.js')
-rw-r--r-- | spec/frontend/monitoring/components/dashboard_spec.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js index 5c7042d4cb5..0c2f85c7298 100644 --- a/spec/frontend/monitoring/components/dashboard_spec.js +++ b/spec/frontend/monitoring/components/dashboard_spec.js @@ -1,3 +1,4 @@ +import { GlAlert } from '@gitlab/ui'; import { shallowMount, mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; import VueDraggable from 'vuedraggable'; @@ -7,7 +8,6 @@ import axios from '~/lib/utils/axios_utils'; import { ESC_KEY } from '~/lib/utils/keys'; import { objectToQuery } from '~/lib/utils/url_utility'; import Dashboard from '~/monitoring/components/dashboard.vue'; - import DashboardHeader from '~/monitoring/components/dashboard_header.vue'; import DashboardPanel from '~/monitoring/components/dashboard_panel.vue'; import EmptyState from '~/monitoring/components/empty_state.vue'; @@ -17,6 +17,7 @@ import LinksSection from '~/monitoring/components/links_section.vue'; import { dashboardEmptyStates, metricStates } from '~/monitoring/constants'; import { createStore } from '~/monitoring/stores'; import * as types from '~/monitoring/stores/mutation_types'; +import AlertDeprecationWarning from '~/vue_shared/components/alerts_deprecation_warning.vue'; import { metricsDashboardViewModel, metricsDashboardPanelCount, @@ -46,6 +47,7 @@ describe('Dashboard', () => { stubs: { DashboardHeader, }, + provide: { hasManagedPrometheus: false }, ...options, }); }; @@ -59,6 +61,9 @@ describe('Dashboard', () => { 'dashboard-panel': true, 'dashboard-header': DashboardHeader, }, + provide: { + hasManagedPrometheus: false, + }, ...options, }); }; @@ -812,4 +817,25 @@ describe('Dashboard', () => { expect(dashboardPanel.exists()).toBe(true); }); }); + + describe('deprecation notice', () => { + beforeEach(() => { + setupStoreWithData(store); + }); + + const findDeprecationNotice = () => + wrapper.find(AlertDeprecationWarning).findComponent(GlAlert); + + it('shows the deprecation notice when available', () => { + createMountedWrapper({}, { provide: { hasManagedPrometheus: true } }); + + expect(findDeprecationNotice().exists()).toBe(true); + }); + + it('hides the deprecation notice when not available', () => { + createMountedWrapper(); + + expect(findDeprecationNotice().exists()).toBe(false); + }); + }); }); |