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

environment_monitoring_spec.js « environments « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d2129bd7b30ae392903be8ddbfda8f581e64538d (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
import { shallowMount } from '@vue/test-utils';
import MonitoringComponent from '~/environments/components/environment_monitoring.vue';
import Icon from '~/vue_shared/components/icon.vue';

describe('Monitoring Component', () => {
  let wrapper;

  const monitoringUrl = 'https://gitlab.com';

  const createWrapper = () => {
    wrapper = shallowMount(MonitoringComponent, {
      propsData: {
        monitoringUrl,
      },
    });
  };

  const findIcons = () => wrapper.findAll(Icon);
  const findIconsByName = name => findIcons().filter(icon => icon.props('name') === name);

  beforeEach(() => {
    createWrapper();
  });

  describe('computed', () => {
    it('title', () => {
      expect(wrapper.vm.title).toBe('Monitoring');
    });
  });

  it('should render a link to environment monitoring page', () => {
    expect(wrapper.attributes('href')).toEqual(monitoringUrl);
    expect(findIconsByName('chart').length).toBe(1);
    expect(wrapper.attributes('title')).toBe('Monitoring');
    expect(wrapper.attributes('aria-label')).toBe('Monitoring');
  });
});