summaryrefslogtreecommitdiff
path: root/spec/frontend/serverless/components/missing_prometheus_spec.js
blob: 77aca03772bc9c96fa0145e91f7f3f8b4cf5e84f (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 missingPrometheusComponent from '~/serverless/components/missing_prometheus.vue';
import { shallowMount } from '@vue/test-utils';

const createComponent = missingData =>
  shallowMount(missingPrometheusComponent, {
    propsData: {
      clustersPath: '/clusters',
      helpPath: '/help',
      missingData,
    },
  }).vm;

describe('missingPrometheusComponent', () => {
  let vm;

  afterEach(() => {
    vm.$destroy();
  });

  it('should render missing prometheus message', () => {
    vm = createComponent(false);

    expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
      'Function invocation metrics require Prometheus to be installed first.',
    );

    expect(vm.$el.querySelector('glbutton-stub').getAttribute('variant')).toEqual('success');
  });

  it('should render no prometheus data message', () => {
    vm = createComponent(true);

    expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
      'Invocation metrics loading or not available at this time.',
    );
  });
});