monitor.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {
  2. type Monitor,
  3. MonitorStatus,
  4. MonitorType,
  5. ScheduleType,
  6. } from 'sentry/views/monitors/types';
  7. import {ActorFixture} from './actor';
  8. import {ProjectFixture} from './project';
  9. export function MonitorFixture(params: Partial<Monitor> = {}): Monitor {
  10. return {
  11. id: '',
  12. isMuted: false,
  13. name: 'My Monitor',
  14. project: ProjectFixture(),
  15. slug: 'my-monitor',
  16. status: 'active',
  17. owner: ActorFixture(),
  18. type: MonitorType.CRON_JOB,
  19. config: {
  20. checkin_margin: 5,
  21. max_runtime: 10,
  22. timezone: 'America/Los_Angeles',
  23. alert_rule_id: 1234,
  24. failure_issue_threshold: 2,
  25. recovery_threshold: 2,
  26. schedule_type: ScheduleType.CRONTAB,
  27. schedule: '10 * * * *',
  28. },
  29. dateCreated: '2023-01-01T00:00:00Z',
  30. environments: [
  31. {
  32. dateCreated: '2023-01-01T00:10:00Z',
  33. isMuted: false,
  34. lastCheckIn: '2023-12-25T17:13:00Z',
  35. name: 'production',
  36. nextCheckIn: '2023-12-25T16:10:00Z',
  37. nextCheckInLatest: '2023-12-25T15:15:00Z',
  38. status: MonitorStatus.OK,
  39. activeIncident: null,
  40. },
  41. ],
  42. alertRule: {
  43. targets: [{targetIdentifier: 1, targetType: 'Member'}],
  44. },
  45. ...params,
  46. };
  47. }