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.

944 B
Raw Blame
import { router } from 'kea-router'

import { urls } from 'scenes/urls'

import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'

import { aiObservabilitySessionsViewLogic } from './aiObservabilitySessionsViewLogic'

describe('aiObservabilitySessionsViewLogic', () => {
    it('leaves the trace drawer params behind when selecting a session', () => {
        useMocks({ post: { '/api/environments/:team_id/query/:kind/': () => [200, { results: [] }] } })
        initKeaTests()
        router.actions.push(`${urls.aiObservabilitySessions()}?date_from=-7d&trace=a&ts=2026&step=x`)
        const logic = aiObservabilitySessionsViewLogic()
        logic.mount()

        logic.actions.selectSession('session-1')

        expect(router.values.location.pathname).toContain(urls.aiObservabilitySession('session-1'))
        expect(router.values.searchParams).toEqual({ date_from: '-7d' })
        logic.unmount()
    })
})