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

alerts_deprecation_warning_spec.js « components « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b73f4d6a396935d3a07d1d3666d00f97b1305aca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { GlAlert, GlLink } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import AlertDeprecationWarning from '~/vue_shared/components/alerts_deprecation_warning.vue';

describe('AlertDetails', () => {
  let wrapper;

  function mountComponent(hasManagedPrometheus = false) {
    wrapper = mount(AlertDeprecationWarning, {
      provide: {
        hasManagedPrometheus,
      },
    });
  }

  afterEach(() => {
    wrapper.destroy();
    wrapper = null;
  });

  const findAlert = () => wrapper.findComponent(GlAlert);
  const findLink = () => wrapper.findComponent(GlLink);

  describe('Alert details', () => {
    describe('with no manual prometheus', () => {
      beforeEach(() => {
        mountComponent();
      });

      it('renders nothing', () => {
        expect(findAlert().exists()).toBe(false);
      });
    });

    describe('with manual prometheus', () => {
      beforeEach(() => {
        mountComponent(true);
      });

      it('renders a deprecation notice', () => {
        expect(findAlert().text()).toContain('GitLab-managed Prometheus is deprecated');
        expect(findLink().attributes('href')).toContain(
          'operations/metrics/alerts.html#managed-prometheus-instances',
        );
      });
    });
  });
});