Skip to content

Commit

Permalink
Fix jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed May 17, 2022
1 parent 409c606 commit eb1f391
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('aggregate()', () => {
},
snoozed: {
date_range: {
field: 'alert.attributes.snoozeSchedule.startTime',
field: 'alert.attributes.snoozeSchedule.rRule.dtstart',
format: 'strict_date_time',
ranges: [{ from: 'now' }],
},
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('aggregate()', () => {
},
snoozed: {
date_range: {
field: 'alert.attributes.snoozeSchedule.startTime',
field: 'alert.attributes.snoozeSchedule.rRule.dtstart',
format: 'strict_date_time',
ranges: [{ from: 'now' }],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
Expand Down Expand Up @@ -1644,6 +1645,7 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
Expand Down Expand Up @@ -1777,6 +1779,7 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
Expand Down Expand Up @@ -1910,6 +1913,7 @@ describe('create()', () => {
"interval": "1m",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
Expand Down Expand Up @@ -2075,6 +2079,7 @@ describe('create()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"snoozeSchedule": Array [],
"tags": Array [
"foo",
],
Expand Down
32 changes: 28 additions & 4 deletions x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,36 @@ describe('Task Runner', () => {
[false, null, false],
[false, undefined, false],
// Stringify the snooze schedules for better failure reporting
[false, JSON.stringify([{ startTime: DATE_9999, duration: 100000000 }]), false],
[false, JSON.stringify([{ startTime: DATE_1970, duration: 100000000 }]), true],
[
false,
JSON.stringify([
{ rRule: { dtstart: DATE_9999, tzid: 'UTC', count: 1 }, duration: 100000000 },
]),
false,
],
[
false,
JSON.stringify([
{ rRule: { dtstart: DATE_1970, tzid: 'UTC', count: 1 }, duration: 100000000 },
]),
true,
],
[true, null, true],
[true, undefined, true],
[true, JSON.stringify([{ startTime: DATE_9999, duration: 100000000 }]), true],
[true, JSON.stringify([{ startTime: DATE_1970, duration: 100000000 }]), true],
[
true,
JSON.stringify([
{ rRule: { dtstart: DATE_9999, tzid: 'UTC', count: 1 }, duration: 100000000 },
]),
true,
],
[
true,
JSON.stringify([
{ rRule: { dtstart: DATE_1970, tzid: 'UTC', count: 1 }, duration: 100000000 },
]),
true,
],
];

test.each(snoozeTestParams)(
Expand Down

0 comments on commit eb1f391

Please sign in to comment.