debian-mirror-gitlab/spec/frontend/serverless/components/missing_prometheus_spec.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { GlButton } from '@gitlab/ui';
2019-07-07 11:18:12 +05:30
import { shallowMount } from '@vue/test-utils';
2020-01-01 13:55:28 +05:30
import missingPrometheusComponent from '~/serverless/components/missing_prometheus.vue';
2021-03-11 19:13:27 +05:30
import { createStore } from '~/serverless/store';
2019-07-07 11:18:12 +05:30
describe('missingPrometheusComponent', () => {
2019-09-04 21:01:54 +05:30
let wrapper;
2019-07-07 11:18:12 +05:30
2021-03-08 18:12:59 +05:30
const createComponent = (missingData) => {
2020-10-24 23:57:45 +05:30
const store = createStore({ clustersPath: '/clusters', helpPath: '/help' });
wrapper = shallowMount(missingPrometheusComponent, { store, propsData: { missingData } });
};
2019-07-07 11:18:12 +05:30
afterEach(() => {
2019-09-04 21:01:54 +05:30
wrapper.destroy();
2019-07-07 11:18:12 +05:30
});
it('should render missing prometheus message', () => {
2020-10-24 23:57:45 +05:30
createComponent(false);
2019-09-04 21:01:54 +05:30
const { vm } = wrapper;
2019-07-07 11:18:12 +05:30
expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
'Function invocation metrics require Prometheus to be installed first.',
);
2021-01-03 14:25:43 +05:30
expect(wrapper.find(GlButton).attributes('variant')).toBe('success');
2019-07-07 11:18:12 +05:30
});
it('should render no prometheus data message', () => {
2020-10-24 23:57:45 +05:30
createComponent(true);
2019-09-04 21:01:54 +05:30
const { vm } = wrapper;
2019-07-07 11:18:12 +05:30
expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
'Invocation metrics loading or not available at this time.',
);
});
});