textRule.spec.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {render} from 'sentry-test/reactTestingLibrary';
  2. import {TextCondition} from 'sentry/views/alerts/rules/issue/details/textRule';
  3. describe('AlertRuleDetails', () => {
  4. it('displays EventFrequencyCondition percentage', () => {
  5. const wrapper = render(
  6. <TextCondition
  7. condition={{
  8. comparisonType: 'count',
  9. id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition',
  10. interval: '1h',
  11. name: 'The issue is seen more than 1000 times in 1h',
  12. value: 1000,
  13. // TODO(scttcper): label and prompt only exist in the type definition
  14. label: '',
  15. prompt: '',
  16. }}
  17. />
  18. );
  19. expect(wrapper.container).toHaveTextContent(
  20. 'Number of events in an issue is more than 1000 in 1h'
  21. );
  22. });
  23. it('displays EventFrequencyCondition count', () => {
  24. const wrapper = render(
  25. <TextCondition
  26. condition={{
  27. comparisonInterval: '1h',
  28. comparisonType: 'percent',
  29. id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition',
  30. interval: '1h',
  31. name: 'The issue is seen more than 150 times in 1h',
  32. value: 150,
  33. // TODO(scttcper): label and prompt only exist in the type definition
  34. label: '',
  35. prompt: '',
  36. }}
  37. />
  38. );
  39. expect(wrapper.container).toHaveTextContent(
  40. 'Number of events in an issue is 150% higher in 1h compared to 1h ago'
  41. );
  42. });
  43. });