Commit 95ce733d authored by Tristan Read's avatar Tristan Read Committed by Sean Arnold

Add full mount spec for alert metric image tab

parent d40ac8ff
...@@ -13,12 +13,16 @@ import { PAGE_CONFIG, SEVERITY_LEVELS } from '~/vue_shared/alert_details/constan ...@@ -13,12 +13,16 @@ import { PAGE_CONFIG, SEVERITY_LEVELS } from '~/vue_shared/alert_details/constan
import createIssueMutation from '~/vue_shared/alert_details/graphql/mutations/alert_issue_create.mutation.graphql'; import createIssueMutation from '~/vue_shared/alert_details/graphql/mutations/alert_issue_create.mutation.graphql';
import AlertDetailsTable from '~/vue_shared/components/alert_details_table.vue'; import AlertDetailsTable from '~/vue_shared/components/alert_details_table.vue';
import MetricImagesTab from '~/vue_shared/components/metric_images/metric_images_tab.vue'; import MetricImagesTab from '~/vue_shared/components/metric_images/metric_images_tab.vue';
import createStore from '~/vue_shared/components/metric_images/store/';
import service from '~/vue_shared/alert_details/service';
import mockAlerts from './mocks/alerts.json'; import mockAlerts from './mocks/alerts.json';
const mockAlert = mockAlerts[0]; const mockAlert = mockAlerts[0];
const environmentName = 'Production'; const environmentName = 'Production';
const environmentPath = '/fake/path'; const environmentPath = '/fake/path';
jest.mock('~/vue_shared/alert_details/service');
describe('AlertDetails', () => { describe('AlertDetails', () => {
let environmentData = { name: environmentName, path: environmentPath }; let environmentData = { name: environmentName, path: environmentPath };
let mock; let mock;
...@@ -68,10 +72,11 @@ describe('AlertDetails', () => { ...@@ -68,10 +72,11 @@ describe('AlertDetails', () => {
$route: { params: {} }, $route: { params: {} },
}, },
stubs: { stubs: {
...stubs,
AlertSummaryRow, AlertSummaryRow,
'metric-images-tab': true, 'metric-images-tab': true,
...stubs,
}, },
store: createStore({}, service),
}), }),
); );
} }
...@@ -131,8 +136,21 @@ describe('AlertDetails', () => { ...@@ -131,8 +136,21 @@ describe('AlertDetails', () => {
expect(wrapper.findByTestId('startTimeItem').exists()).toBe(true); expect(wrapper.findByTestId('startTimeItem').exists()).toBe(true);
expect(wrapper.findByTestId('startTimeItem').props('time')).toBe(mockAlert.startedAt); expect(wrapper.findByTestId('startTimeItem').props('time')).toBe(mockAlert.startedAt);
}); });
});
describe('Metrics tab', () => {
it('should mount without errors', () => {
mountComponent({
mountMethod: mount,
provide: {
canUpdate: true,
iid: '1',
},
stubs: {
MetricImagesTab,
},
});
it('renders the metrics tab', () => {
expect(findMetricsTab().exists()).toBe(true); expect(findMetricsTab().exists()).toBe(true);
}); });
}); });
...@@ -314,7 +332,9 @@ describe('AlertDetails', () => { ...@@ -314,7 +332,9 @@ describe('AlertDetails', () => {
describe('header', () => { describe('header', () => {
const findHeader = () => wrapper.findByTestId('alert-header'); const findHeader = () => wrapper.findByTestId('alert-header');
const stubs = { TimeAgoTooltip: { template: '<span>now</span>' } }; const stubs = {
TimeAgoTooltip: { template: '<span>now</span>' },
};
describe('individual header fields', () => { describe('individual header fields', () => {
describe.each` describe.each`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment