debian-mirror-gitlab/spec/frontend/analytics/instance_statistics/components/app_spec.js

46 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { shallowMount } from '@vue/test-utils';
import InstanceStatisticsApp from '~/analytics/instance_statistics/components/app.vue';
import InstanceCounts from '~/analytics/instance_statistics/components//instance_counts.vue';
2021-01-29 00:20:46 +05:30
import InstanceStatisticsCountChart from '~/analytics/instance_statistics/components/instance_statistics_count_chart.vue';
2021-01-03 14:25:43 +05:30
import UsersChart from '~/analytics/instance_statistics/components/users_chart.vue';
2021-01-29 00:20:46 +05:30
import ProjectsAndGroupsChart from '~/analytics/instance_statistics/components/projects_and_groups_chart.vue';
2021-01-03 14:25:43 +05:30
describe('InstanceStatisticsApp', () => {
let wrapper;
const createComponent = () => {
wrapper = shallowMount(InstanceStatisticsApp);
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it('displays the instance counts component', () => {
expect(wrapper.find(InstanceCounts).exists()).toBe(true);
});
2021-01-29 00:20:46 +05:30
['Pipelines', 'Issues & Merge Requests'].forEach(instance => {
it(`displays the ${instance} chart`, () => {
const chartTitles = wrapper
.findAll(InstanceStatisticsCountChart)
.wrappers.map(chartComponent => chartComponent.props('chartTitle'));
expect(chartTitles).toContain(instance);
});
2021-01-03 14:25:43 +05:30
});
it('displays the users chart component', () => {
expect(wrapper.find(UsersChart).exists()).toBe(true);
});
2021-01-29 00:20:46 +05:30
it('displays the projects and groups chart component', () => {
expect(wrapper.find(ProjectsAndGroupsChart).exists()).toBe(true);
});
2021-01-03 14:25:43 +05:30
});