2021-04-17 20:07:23 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import UsageTrendsApp from '~/analytics/usage_trends/components/app.vue';
|
|
|
|
import UsageCounts from '~/analytics/usage_trends/components/usage_counts.vue';
|
|
|
|
import UsageTrendsCountChart from '~/analytics/usage_trends/components/usage_trends_count_chart.vue';
|
|
|
|
import UsersChart from '~/analytics/usage_trends/components/users_chart.vue';
|
|
|
|
|
|
|
|
describe('UsageTrendsApp', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const createComponent = () => {
|
|
|
|
wrapper = shallowMount(UsageTrendsApp);
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
createComponent();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('displays the usage counts component', () => {
|
2022-10-11 01:57:18 +05:30
|
|
|
expect(wrapper.findComponent(UsageCounts).exists()).toBe(true);
|
2021-04-17 20:07:23 +05:30
|
|
|
});
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
['Total projects & groups', 'Pipelines', 'Issues & merge requests'].forEach((usage) => {
|
2021-04-17 20:07:23 +05:30
|
|
|
it(`displays the ${usage} chart`, () => {
|
|
|
|
const chartTitles = wrapper
|
2022-10-11 01:57:18 +05:30
|
|
|
.findAllComponents(UsageTrendsCountChart)
|
2021-04-17 20:07:23 +05:30
|
|
|
.wrappers.map((chartComponent) => chartComponent.props('chartTitle'));
|
|
|
|
|
|
|
|
expect(chartTitles).toContain(usage);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('displays the users chart component', () => {
|
2022-10-11 01:57:18 +05:30
|
|
|
expect(wrapper.findComponent(UsersChart).exists()).toBe(true);
|
2021-04-17 20:07:23 +05:30
|
|
|
});
|
|
|
|
});
|