diff --git a/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_category.test.tsx b/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_category.test.tsx index d325c92f14c65..16b20119c9607 100644 --- a/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_category.test.tsx +++ b/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_category.test.tsx @@ -37,6 +37,30 @@ jest.mock('../../../common/formatting', () => ({ getCalendar: (timestamp: number) => `triggered:${timestamp}`, })); +const mockAlert = { + id: '', + enabled: true, + tags: [], + consumer: '', + schedule: { interval: '1m' }, + actions: [], + params: {}, + createdBy: null, + updatedBy: null, + createdAt: new Date('2020-12-08'), + updatedAt: new Date('2020-12-08'), + apiKey: null, + apiKeyOwner: null, + throttle: null, + muteAll: false, + mutedInstanceIds: [], + executionStatus: { + status: AlertExecutionStatusValues[0], + lastExecutionDate: new Date('2020-12-08'), + }, + notifyWhen: null, +}; + function getAllAlerts() { return ALERTS.reduce((accum: AlertsByName, alertType) => { accum[alertType] = { @@ -44,26 +68,7 @@ function getAllAlerts() { rawAlert: { alertTypeId: alertType, name: `${alertType}_label`, - id: '', - enabled: true, - tags: [], - consumer: '', - schedule: { interval: '1m' }, - actions: [], - params: {}, - createdBy: null, - updatedBy: null, - createdAt: new Date('2020-12-08'), - updatedAt: new Date('2020-12-08'), - apiKey: null, - apiKeyOwner: null, - throttle: null, - muteAll: false, - mutedInstanceIds: [], - executionStatus: { - status: AlertExecutionStatusValues[0], - lastExecutionDate: new Date('2020-12-08'), - }, + ...mockAlert, }, }; return accum; @@ -106,26 +111,7 @@ describe('getAlertPanelsByCategory', () => { rawAlert: { alertTypeId: type, name: `${type}_label`, - id: '', - enabled: true, - tags: [], - consumer: '', - schedule: { interval: '1m' }, - actions: [], - params: {}, - createdBy: null, - updatedBy: null, - createdAt: new Date('2020-12-08'), - updatedAt: new Date('2020-12-08'), - apiKey: null, - apiKeyOwner: null, - throttle: null, - muteAll: false, - mutedInstanceIds: [], - executionStatus: { - status: AlertExecutionStatusValues[0], - lastExecutionDate: new Date('2020-12-08'), - }, + ...mockAlert, }, }; } diff --git a/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_node.test.tsx b/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_node.test.tsx index c965819bfee20..be6ccb1e0981b 100644 --- a/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_node.test.tsx +++ b/x-pack/plugins/monitoring/public/alerts/lib/get_alert_panels_by_node.test.tsx @@ -35,6 +35,30 @@ jest.mock('../../../common/formatting', () => ({ getCalendar: (timestamp: number) => `triggered:${timestamp}`, })); +const mockAlert = { + id: '', + enabled: true, + tags: [], + consumer: '', + schedule: { interval: '1m' }, + actions: [], + params: {}, + createdBy: null, + updatedBy: null, + createdAt: new Date('2020-12-08'), + updatedAt: new Date('2020-12-08'), + apiKey: null, + apiKeyOwner: null, + throttle: null, + muteAll: false, + mutedInstanceIds: [], + executionStatus: { + status: AlertExecutionStatusValues[0], + lastExecutionDate: new Date('2020-12-08'), + }, + notifyWhen: null, +}; + describe('getAlertPanelsByNode', () => { const ui = { isFiring: false, @@ -67,26 +91,7 @@ describe('getAlertPanelsByNode', () => { rawAlert: { alertTypeId: type, name: `${type}_label`, - id: '', - enabled: true, - tags: [], - consumer: '', - schedule: { interval: '1m' }, - actions: [], - params: {}, - createdBy: null, - updatedBy: null, - createdAt: new Date('2020-12-08'), - updatedAt: new Date('2020-12-08'), - apiKey: null, - apiKeyOwner: null, - throttle: null, - muteAll: false, - mutedInstanceIds: [], - executionStatus: { - status: AlertExecutionStatusValues[0], - lastExecutionDate: new Date('2020-12-08'), - }, + ...mockAlert, }, states, };