2020-11-24 15:15:51 +05:30
|
|
|
import { GlButton } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2020-01-01 13:55:28 +05:30
|
|
|
import MonitoringComponent from '~/environments/components/environment_monitoring.vue';
|
|
|
|
|
|
|
|
describe('Monitoring Component', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const monitoringUrl = 'https://gitlab.com';
|
|
|
|
|
|
|
|
const createWrapper = () => {
|
|
|
|
wrapper = shallowMount(MonitoringComponent, {
|
|
|
|
propsData: {
|
|
|
|
monitoringUrl,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const findButtons = () => wrapper.findAll(GlButton);
|
2021-03-08 18:12:59 +05:30
|
|
|
const findButtonsByIcon = (icon) =>
|
|
|
|
findButtons().filter((button) => button.props('icon') === icon);
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
createWrapper();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('computed', () => {
|
|
|
|
it('title', () => {
|
|
|
|
expect(wrapper.vm.title).toBe('Monitoring');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link to environment monitoring page', () => {
|
|
|
|
expect(wrapper.attributes('href')).toEqual(monitoringUrl);
|
2020-11-24 15:15:51 +05:30
|
|
|
expect(findButtonsByIcon('chart').length).toBe(1);
|
2020-03-13 15:44:24 +05:30
|
|
|
expect(wrapper.attributes('title')).toBe('Monitoring');
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(wrapper.attributes('aria-label')).toBe('Monitoring');
|
|
|
|
});
|
|
|
|
});
|