0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
posthog/ee/frontend/mobile-replay/parsing.test.ts

21 lines
883 B
TypeScript

import { parseEncodedSnapshots } from 'scenes/session-recordings/player/sessionRecordingDataLogic'
import { encodedWebSnapshotData } from './__mocks__/encoded-snapshot-data'
describe('snapshot parsing', () => {
const sessionId = '12345'
const numberOfParsedLinesInData = 3
it('handles normal mobile data', async () => {
const parsed = await parseEncodedSnapshots(encodedWebSnapshotData, sessionId, true)
expect(parsed.length).toEqual(numberOfParsedLinesInData)
expect(parsed).toMatchSnapshot()
})
it('handles mobile data with no meta event', async () => {
const withoutMeta = [encodedWebSnapshotData[0], encodedWebSnapshotData[2]]
const parsed = await parseEncodedSnapshots(withoutMeta, sessionId, true)
expect(parsed.length).toEqual(numberOfParsedLinesInData)
expect(parsed).toMatchSnapshot()
})
})