gitlab-org--gitlab-foss/spec/frontend/serverless/components/missing_prometheus_spec.js

38 lines
1 KiB
JavaScript
Raw Normal View History

2019-04-05 22:02:39 -04:00
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.',
);
});
});