2020-01-01 13:55:28 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import MonitoringComponent from '~/environments/components/environment_monitoring.vue';
|
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
|
|
|
|
|
|
|
describe('Monitoring Component', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const monitoringUrl = 'https://gitlab.com';
|
|
|
|
|
|
|
|
const createWrapper = () => {
|
|
|
|
wrapper = shallowMount(MonitoringComponent, {
|
|
|
|
propsData: {
|
|
|
|
monitoringUrl,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const findIcons = () => wrapper.findAll(Icon);
|
|
|
|
const findIconsByName = name => findIcons().filter(icon => icon.props('name') === name);
|
|
|
|
|
|
|
|
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);
|
|
|
|
expect(findIconsByName('chart').length).toBe(1);
|
2020-03-09 13:42:32 +05:30
|
|
|
expect(wrapper.attributes('title')).toBe('Monitoring');
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(wrapper.attributes('aria-label')).toBe('Monitoring');
|
|
|
|
});
|
|
|
|
});
|