Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
mgiota committed Apr 20, 2022
1 parent 1e97f40 commit d7da3f4
Showing 1 changed file with 41 additions and 16 deletions.
57 changes: 41 additions & 16 deletions x-pack/plugins/observability/public/pages/rules/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { createObservabilityRuleTypeRegistryMock } from '../../rules/observabili
import { AppMountParameters } from '@kbn/core/public';
import { ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common';
import { RuleState } from './types';
import { Rule } from '@kbn/triggers-actions-ui-plugin/public';

const mockUseKibanaReturnValue = kibanaStartMock.startContract();

jest.mock('../../utils/kibana_react', () => ({
Expand Down Expand Up @@ -167,7 +169,7 @@ describe('empty RulesPage with show only capability', () => {
describe('RulesPage with items', () => {
let wrapper: ReactWrapper<any>;
async function setup() {
const mockedRulesData = [
const mockedRulesData: Rule[] = [
{
id: '1',
name: 'test rule',
Expand All @@ -177,33 +179,38 @@ describe('RulesPage with items', () => {
schedule: { interval: '1s' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'active',
lastDuration: 500,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
},
monitoring: {
execution: {
history: [
{
success: true,
duration: 1000000,
timestamp: 1234567,
},
{
success: true,
duration: 200000,
timestamp: 1234567,
},
{
success: false,
duration: 300000,
timestamp: 1234567,
},
],
calculated_metrics: {
Expand All @@ -224,29 +231,34 @@ describe('RulesPage with items', () => {
schedule: { interval: '5d' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'ok',
lastDuration: 61000,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
error: undefined,
},
monitoring: {
execution: {
history: [
{
success: true,
duration: 100000,
timestamp: 1234567,
},
{
success: true,
duration: 500000,
timestamp: 1234567,
},
],
calculated_metrics: {
Expand All @@ -267,22 +279,24 @@ describe('RulesPage with items', () => {
schedule: { interval: '5d' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'pending',
lastDuration: 30234,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
},
monitoring: {
execution: {
history: [{ success: false, duration: 100 }],
history: [{ success: false, duration: 100, timestamp: 1234567 }],
calculated_metrics: {
success_ratio: 0,
},
Expand Down Expand Up @@ -355,7 +369,7 @@ describe('RulesPage with items', () => {
describe('RulesPage with items and show only capability', () => {
let wrapper: ReactWrapper<any>;
async function setup() {
const mockedRulesData = [
const mockedRulesData: Rule[] = [
{
id: '1',
name: 'test rule',
Expand All @@ -365,33 +379,38 @@ describe('RulesPage with items and show only capability', () => {
schedule: { interval: '1s' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'active',
lastDuration: 500,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
},
monitoring: {
execution: {
history: [
{
success: true,
duration: 1000000,
timestamp: 1234567,
},
{
success: true,
duration: 200000,
timestamp: 1234567,
},
{
success: false,
duration: 300000,
timestamp: 1234567,
},
],
calculated_metrics: {
Expand All @@ -412,29 +431,33 @@ describe('RulesPage with items and show only capability', () => {
schedule: { interval: '5d' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'ok',
lastDuration: 61000,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
},
monitoring: {
execution: {
history: [
{
success: true,
duration: 100000,
timestamp: 1234567,
},
{
success: true,
duration: 500000,
timestamp: 1234567,
},
],
calculated_metrics: {
Expand All @@ -455,22 +478,24 @@ describe('RulesPage with items and show only capability', () => {
schedule: { interval: '5d' },
actions: [],
params: { name: 'test rule type name' },
scheduledTaskId: null,
createdBy: null,
updatedBy: null,
apiKeyOwner: null,
throttle: '1m',
muteAll: false,
mutedInstanceIds: [],
createdAt: new Date(),
updatedAt: new Date(),
consumer: 'alerts',
notifyWhen: 'onActiveAlert',
executionStatus: {
status: 'pending',
lastDuration: 30234,
lastExecutionDate: new Date('2020-08-20T19:23:38Z'),
error: null,
},
monitoring: {
execution: {
history: [{ success: false, duration: 100 }],
history: [{ success: false, duration: 100, timestamp: 1234567 }],
calculated_metrics: {
success_ratio: 0,
},
Expand Down

0 comments on commit d7da3f4

Please sign in to comment.