Skip to content

Commit

Permalink
Fix jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jul 9, 2020
1 parent 313f714 commit 694d01b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('The metric threshold alert type', () => {
expect(getState(instanceID).alertState).toBe(AlertStates.OK);
});
test('reports expected values to the action context', async () => {
const now = Date.now();
const now = 1577858400000;
await execute(Comparator.GT, [0.75]);
const { action } = mostRecentAction(instanceID);
expect(action.group).toBe('*');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const createMetricThresholdExecutor = (libs: InfraBackendLibs, alertId: s
}
if (reason) {
const firstResult = first(alertResults);
const timestamp = firstResult ? firstResult[group].timestamp : moment().toISOString();
const timestamp = (firstResult && firstResult[group].timestamp) ?? moment().toISOString();
alertInstance.scheduleActions(FIRED_ACTIONS.id, {
group,
alertState: stateToAlertMessage[nextState],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const bucketsA = [
{
doc_count: 3,
aggregatedValue: { value: 1.0, values: [{ key: 95.0, value: 1.0 }] },
key_as_string: new Date(1577858400000).toISOString(),
},
];

Expand Down

0 comments on commit 694d01b

Please sign in to comment.