hydrateFrames.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import hydrateFrames from 'sentry/utils/replays/hydrateFrames';
  2. describe('hydrateFrames', () => {
  3. it('should split breadcrumbs, spans, option and rrweb frames apart', () => {
  4. const crumbProps = {timestamp: new Date()};
  5. const spanProps = {startTimestamp: new Date(), endTimestamp: new Date()};
  6. const optionsFrame = TestStubs.Replay.OptionFrame({});
  7. const attachments = [
  8. ...TestStubs.Replay.RRWebInitFrameEvents(crumbProps),
  9. TestStubs.Replay.OptionFrameEvent({
  10. timestamp: new Date(),
  11. data: {payload: optionsFrame},
  12. }),
  13. TestStubs.Replay.ConsoleEvent(crumbProps),
  14. TestStubs.Replay.ConsoleEvent(crumbProps),
  15. TestStubs.Replay.MemoryEvent(spanProps),
  16. TestStubs.Replay.MemoryEvent(spanProps),
  17. TestStubs.Replay.MemoryEvent(spanProps),
  18. TestStubs.Replay.MemoryEvent(spanProps),
  19. ];
  20. const {breadcrumbFrames, optionFrame, rrwebFrames, spanFrames} =
  21. hydrateFrames(attachments);
  22. expect(breadcrumbFrames).toHaveLength(2);
  23. expect(optionFrame).toStrictEqual(optionsFrame);
  24. expect(rrwebFrames).toHaveLength(3);
  25. expect(spanFrames).toHaveLength(4);
  26. });
  27. });