2019-09-04 21:01:54 +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';
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
const createComponent = missingData =>
|
|
|
|
shallowMount(missingPrometheusComponent, {
|
|
|
|
propsData: {
|
|
|
|
clustersPath: '/clusters',
|
|
|
|
helpPath: '/help',
|
|
|
|
missingData,
|
|
|
|
},
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|
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
|
|
|
|
|
|
|
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', () => {
|
2019-09-04 21:01:54 +05:30
|
|
|
wrapper = createComponent(false);
|
|
|
|
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.',
|
|
|
|
);
|
|
|
|
|
2019-09-04 21:01:54 +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', () => {
|
2019-09-04 21:01:54 +05:30
|
|
|
wrapper = createComponent(true);
|
|
|
|
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.',
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|