debian-mirror-gitlab/spec/frontend/analytics/components/activity_chart_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1 KiB
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import { GlColumnChart } from '@gitlab/ui/dist/charts';
2021-03-11 19:13:27 +05:30
import { shallowMount } from '@vue/test-utils';
2020-10-24 23:57:45 +05:30
import ActivityChart from '~/analytics/product_analytics/components/activity_chart.vue';
describe('Activity Chart Bundle', () => {
let wrapper;
function mountComponent({ provide }) {
wrapper = shallowMount(ActivityChart, {
provide: {
formattedData: {},
...provide,
},
});
}
2022-10-11 01:57:18 +05:30
const findChart = () => wrapper.findComponent(GlColumnChart);
2020-10-24 23:57:45 +05:30
const findNoData = () => wrapper.find('[data-testid="noActivityChartData"]');
describe('Activity Chart', () => {
it('renders an warning message with no data', () => {
mountComponent({ provide: { formattedData: {} } });
expect(findNoData().exists()).toBe(true);
});
it('renders a chart with data', () => {
mountComponent({
provide: { formattedData: { keys: ['key1', 'key2'], values: [5038, 2241] } },
});
expect(findNoData().exists()).toBe(false);
expect(findChart().exists()).toBe(true);
});
});
});