diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/alert_management/components/alert_metrics_spec.js | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/alert_management/components/alert_metrics_spec.js')
-rw-r--r-- | spec/frontend/alert_management/components/alert_metrics_spec.js | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/spec/frontend/alert_management/components/alert_metrics_spec.js b/spec/frontend/alert_management/components/alert_metrics_spec.js deleted file mode 100644 index 42da8c3768b..00000000000 --- a/spec/frontend/alert_management/components/alert_metrics_spec.js +++ /dev/null @@ -1,62 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import waitForPromises from 'helpers/wait_for_promises'; -import MockAdapter from 'axios-mock-adapter'; -import axios from 'axios'; -import AlertMetrics from '~/alert_management/components/alert_metrics.vue'; -import MetricEmbed from '~/monitoring/components/embeds/metric_embed.vue'; - -jest.mock('~/monitoring/stores', () => ({ - monitoringDashboard: {}, -})); - -jest.mock('~/monitoring/components/embeds/metric_embed.vue', () => ({ - render(h) { - return h('div'); - }, -})); - -describe('Alert Metrics', () => { - let wrapper; - const mock = new MockAdapter(axios); - - function mountComponent({ props } = {}) { - wrapper = shallowMount(AlertMetrics, { - propsData: { - ...props, - }, - }); - } - - const findChart = () => wrapper.find(MetricEmbed); - const findEmptyState = () => wrapper.find({ ref: 'emptyState' }); - - afterEach(() => { - if (wrapper) { - wrapper.destroy(); - } - }); - - afterAll(() => { - mock.restore(); - }); - - describe('Empty state', () => { - it('should display a message when metrics dashboard url is not provided ', () => { - mountComponent(); - expect(findChart().exists()).toBe(false); - expect(findEmptyState().text()).toBe("Metrics weren't available in the alerts payload."); - }); - }); - - describe('Chart', () => { - it('should be rendered when dashboard url is provided', async () => { - mountComponent({ props: { dashboardUrl: 'metrics.url' } }); - - await waitForPromises(); - await wrapper.vm.$nextTick(); - - expect(findEmptyState().exists()).toBe(false); - expect(findChart().exists()).toBe(true); - }); - }); -}); |