throughputChart.spec.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {render, screen, waitForElementToBeRemoved} from 'sentry-test/reactTestingLibrary';
  3. import {ThroughputChart} from 'sentry/views/performance/queues/charts/throughputChart';
  4. import {Referrer} from 'sentry/views/performance/queues/referrers';
  5. describe('throughputChart', () => {
  6. const organization = OrganizationFixture();
  7. let eventsStatsMock;
  8. beforeEach(() => {
  9. eventsStatsMock = MockApiClient.addMockResponse({
  10. url: `/organizations/${organization.slug}/events-stats/`,
  11. method: 'GET',
  12. body: {
  13. data: [],
  14. },
  15. });
  16. });
  17. it('renders', async () => {
  18. render(<ThroughputChart referrer={Referrer.QUEUES_SUMMARY_CHARTS} />, {organization});
  19. screen.getByText('Published vs Processed');
  20. expect(eventsStatsMock).toHaveBeenCalledWith(
  21. '/organizations/org-slug/events-stats/',
  22. expect.objectContaining({
  23. query: expect.objectContaining({
  24. yAxis: [
  25. 'avg_if(span.duration,span.op,queue.publish)',
  26. 'avg_if(span.duration,span.op,queue.process)',
  27. 'avg(messaging.message.receive.latency)',
  28. 'count_op(queue.publish)',
  29. 'count_op(queue.process)',
  30. ],
  31. query: 'span.op:[queue.process,queue.publish]',
  32. }),
  33. })
  34. );
  35. await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator'));
  36. });
  37. });