throughputChart.spec.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {render, screen, waitForElementToBeRemoved} from 'sentry-test/reactTestingLibrary';
  3. import {ThroughputChart} from 'sentry/views/insights/queues/charts/throughputChart';
  4. import {Referrer} from 'sentry/views/insights/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(span.duration)',
  26. 'avg(messaging.message.receive.latency)',
  27. 'spm()',
  28. ],
  29. query: 'span.op:queue.process',
  30. }),
  31. })
  32. );
  33. expect(eventsStatsMock).toHaveBeenCalledWith(
  34. '/organizations/org-slug/events-stats/',
  35. expect.objectContaining({
  36. query: expect.objectContaining({
  37. yAxis: ['avg(span.duration)', 'spm()'],
  38. query: 'span.op:queue.publish',
  39. }),
  40. })
  41. );
  42. await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator'));
  43. });
  44. });