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

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
import { GlButton } from '@gitlab/ui';
2019-07-07 11:18:12 +05:30
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,
},
sync: false,
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.',
);
});
});