samplingSDKClientRateChangeAlert.spec.tsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import {SamplingSDKClientRateChangeAlert} from 'sentry/views/settings/project/server-side-sampling/samplingSDKClientRateChangeAlert';
  3. import {getMockData} from './testUtils';
  4. const otherOutcomesGroups = TestStubs.Outcomes().groups.filter(
  5. group => group.by.outcome !== 'accepted' && group.by.outcome !== 'client_discard'
  6. );
  7. const stats = {
  8. ...TestStubs.Outcomes(),
  9. groups: [
  10. ...otherOutcomesGroups,
  11. {
  12. by: {outcome: 'accepted'},
  13. totals: {'sum(quantity)': 1231342},
  14. series: {
  15. 'sum(quantity)': [
  16. 0, 0, 0, 1, 94, 1, 1, 0, 566, 179, 1, 1, 1, 0, 222, 6, 287, 465, 83, 7, 0, 1835,
  17. 145, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 849, 25331, 147200, 220014, 189001, 99590,
  18. 81288, 134522, 151489, 128585, 41643, 6404, 145, 1381,
  19. ],
  20. },
  21. },
  22. {
  23. by: {outcome: 'client_discard'},
  24. totals: {'sum(quantity)': 18868070},
  25. series: {
  26. 'sum(quantity)': [
  27. 0, 0, 0, 259581, 246831, 278464, 290677, 242770, 242559, 248963, 250920, 268994,
  28. 296129, 308165, 302398, 301891, 316698, 333888, 336204, 329735, 323717, 317564,
  29. 312407, 307008, 301681, 299652, 276849, 274486, 298985, 368148, 444434, 423119,
  30. 416110, 464443, 526387, 692300, 720026, 719854, 719658, 719237, 717889, 719757,
  31. 718147, 719843, 712099, 643028, 545065, 311310,
  32. ],
  33. },
  34. },
  35. ],
  36. };
  37. describe('Server-Side Sampling - Client Rate Change Alert', function () {
  38. it('does not render content', function () {
  39. const {organization, project} = getMockData();
  40. render(
  41. <SamplingSDKClientRateChangeAlert
  42. organization={organization}
  43. projectId={project.id}
  44. onReadDocs={jest.fn()}
  45. projectStats={TestStubs.Outcomes()}
  46. />
  47. );
  48. expect(
  49. screen.queryByText(
  50. 'To allow more metrics to be processed, we suggest changing your client(SDK) sample rate.'
  51. )
  52. ).not.toBeInTheDocument();
  53. });
  54. it('renders content with change sdk sample rate info', function () {
  55. const {organization, project} = getMockData();
  56. render(
  57. <SamplingSDKClientRateChangeAlert
  58. organization={organization}
  59. projectId={project.id}
  60. onReadDocs={jest.fn()}
  61. projectStats={stats}
  62. />
  63. );
  64. expect(
  65. screen.getByText(
  66. 'To allow more metrics to be processed, we suggest changing your client(SDK) sample rate.'
  67. )
  68. ).toBeInTheDocument();
  69. });
  70. });