chartPanel.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  3. import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
  4. describe('chartPanel', function () {
  5. const {organization} = initializeOrg({
  6. organization: {features: ['insights-alerts', 'insights-initial-modules']},
  7. });
  8. it('should render create alert options', async function () {
  9. const alertConfigs = [
  10. {
  11. aggregate: 'avg(d:spans/duration@millisecond)',
  12. query: 'span.module:db has:span.description',
  13. name: 'Average DB Duration',
  14. },
  15. {
  16. aggregate: 'spm()',
  17. query: 'span.module:db has:span.description',
  18. name: 'DB Spans per minute',
  19. },
  20. ];
  21. render(
  22. <ChartPanel title="Avg Latency" alertConfigs={alertConfigs}>
  23. <div />
  24. </ChartPanel>,
  25. {organization}
  26. );
  27. await userEvent.click(screen.getByLabelText('Chart Actions'));
  28. screen.getByText('Average DB Duration');
  29. screen.getByText('DB Spans per minute');
  30. });
  31. });