: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import '@testing-library/jest-dom'
import { cleanup, render, screen } from '@testing-library/react'
import { ReadonlyRunSurface } from './ReadonlyRunSurface'
// Stand in for the heavy impl chunk so the test exercises the lazy/Suspense wiring, not the real surface.
jest.mock('./ReadonlyRunSurfaceImpl', () => ({ __esModule: true, default: () => <div data-attr="thread" /> }))
jest.mock('./RunLogSkeleton', () => ({ RunLogSkeleton: () => <div data-attr="run-log-skeleton" /> }))
describe('ReadonlyRunSurface', () => {
afterEach(() => {
cleanup()
})
it('lazy-loads behind the run-log skeleton, then renders the thread', async () => {
render(<ReadonlyRunSurface taskId="task-1" runId="run-1" interaction="read-only" />)
// The Suspense fallback shows the shared skeleton while the impl chunk resolves...
expect(screen.getByTestId('run-log-skeleton')).toBeInTheDocument()
// ...then the lazily-imported surface mounts and the thread appears.
expect(await screen.findByTestId('thread')).toBeInTheDocument()
})
})