Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Dec 13, 2020
1 parent ee0e99d commit 5ff14e5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,38 @@ 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] = {
states: [],
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;
Expand Down Expand Up @@ -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,
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 5ff14e5

Please sign in to comment.