From 0eaf3022e1f5d7321918d25a71a0c40ba180a8c0 Mon Sep 17 00:00:00 2001 From: jpdjere Date: Wed, 28 Dec 2022 12:12:39 +0100 Subject: [PATCH] Tests --- x-pack/plugins/alerting/server/lib/last_run_status.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/alerting/server/lib/last_run_status.test.ts b/x-pack/plugins/alerting/server/lib/last_run_status.test.ts index d6b6f62b1b60a..6af9fe0f4ffd2 100644 --- a/x-pack/plugins/alerting/server/lib/last_run_status.test.ts +++ b/x-pack/plugins/alerting/server/lib/last_run_status.test.ts @@ -71,7 +71,7 @@ describe('lastRunFromState', () => { ); expect(result.lastRun.outcome).toEqual('warning'); - expect(result.lastRun.outcomeMsg).toEqual(['Rule execution reported a warning']); + expect(result.lastRun.outcomeMsg).toEqual(['MOCK_WARNING', 'Rule execution reported a warning']); expect(result.lastRun.warning).toEqual(null); expect(result.lastRun.alertsCount).toEqual({ @@ -136,12 +136,13 @@ describe('lastRunFromState', () => { }, getRuleResultService({ warnings: ['MOCK_WARNING'], - outcomeMessage: 'Rule execution reported a warning', + outcomeMessage: ruleExecutionOutcomeMessage, }) ); expect(result.lastRun.outcome).toEqual('warning'); expect(result.lastRun.outcomeMsg).toEqual([ + 'MOCK_WARNING', frameworkOutcomeMessage, ruleExecutionOutcomeMessage, ]); @@ -171,6 +172,7 @@ describe('lastRunFromState', () => { expect(result.lastRun.outcome).toEqual('warning'); expect(result.lastRun.outcomeMsg).toEqual([ + 'MOCK_WARNING', frameworkOutcomeMessage, ruleExecutionOutcomeMessage, ]); @@ -197,6 +199,7 @@ describe('lastRunFromState', () => { expect(result.lastRun.outcome).toEqual('failed'); expect(result.lastRun.outcomeMsg).toEqual([ + 'MOCK_ERROR', 'Rule reported more than the maximum number of alerts in a single run. Alerts may be missed and recovery notifications may be delayed', 'Rule execution reported an error', ]);