getMemoryInfoKnownDataDetails.spec.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {EventFixture} from 'sentry-fixture/event';
  2. import {
  3. getMemoryInfoKnownDataDetails,
  4. memoryInfoKnownDataValues,
  5. } from 'sentry/components/events/contexts/memoryInfo/getMemoryInfoKnownDataDetails';
  6. import {memoryInfoMockData} from './index.spec';
  7. describe('getMemoryInfoKnownDataDetails', function () {
  8. it('returns values and according to the parameters', function () {
  9. const allKnownData: ReturnType<typeof getMemoryInfoKnownDataDetails>[] = [];
  10. for (const type of Object.keys(memoryInfoKnownDataValues)) {
  11. const memoryInfoKnownData = getMemoryInfoKnownDataDetails({
  12. type: memoryInfoKnownDataValues[type],
  13. data: memoryInfoMockData,
  14. event: EventFixture(),
  15. });
  16. if (!memoryInfoKnownData) {
  17. continue;
  18. }
  19. allKnownData.push(memoryInfoKnownData);
  20. }
  21. expect(allKnownData).toEqual([
  22. {subject: 'Allocated Bytes', value: 9614872},
  23. {subject: 'Fragmented Bytes', value: undefined},
  24. {subject: 'Heap Size Bytes', value: undefined},
  25. {subject: 'High Memory Load Threshold Bytes', value: 30923764531},
  26. {subject: 'Total Available Memory Bytes', value: 34359738368},
  27. {subject: 'Memory Load Bytes', value: undefined},
  28. {subject: 'Total Committed Bytes', value: undefined},
  29. {subject: 'Promoted Bytes', value: undefined},
  30. {subject: 'Pinned Objects Count', value: undefined},
  31. {subject: 'Pause Time Percentage', value: undefined},
  32. {subject: 'Index', value: undefined},
  33. {subject: 'Finalization Pending Count', value: 0},
  34. {subject: 'Compacted', value: false},
  35. {subject: 'Concurrent', value: false},
  36. {subject: 'Pause Durations', value: [0, 0]},
  37. ]);
  38. });
  39. });