Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

703 B
Raw Blame
import { isReportId } from './ids'

describe('isReportId', () => {
    test.each([
        ['a report uuid', '0199a2b4-7c1e-7d3f-9a5b-2c4d6e8f0a1b', false, true],
        ['a demo fixture id in demo mode', 'demo-report-load-time', true, true],
        ['a demo fixture id outside demo mode', 'demo-report-load-time', false, false],
        ['a path that leaves the report endpoint', '../../tasks/0199a2b4-7c1e-7d3f-9a5b-2c4d6e8f0a1b', false, false],
        ['a uuid with a query string', '0199a2b4-7c1e-7d3f-9a5b-2c4d6e8f0a1b?view=all', false, false],
        ['an empty id', '', true, false],
    ])('%s', (_name, id, demo, expected) => {
        expect(isReportId(id, demo)).toBe(expected)
    })
})