: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 { combineUrl } from 'kea-router'
import { traceLookupDateRange, tracingUrlForService } from './traceLinks'
describe('traceLinks', () => {
it('traceLookupDateRange bounds the lookup to ±1h around the hint', () => {
expect(traceLookupDateRange('2026-06-11T08:00:00.000Z')).toEqual({
date_from: '2026-06-11T07:00:00.000Z',
date_to: '2026-06-11T09:00:00.000Z',
})
})
describe('tracingUrlForService', () => {
const paramsOf = (url: string): Record<string, any> => combineUrl(url).searchParams
it('carries the service as a list, so a name with a comma stays one service', () => {
// tracingSceneLogic reads this back through parseTagsFilter, which splits a bare
// string on commas — 'checkout,v2' would arrive as two services.
expect(paramsOf(tracingUrlForService('checkout,v2')).serviceNames).toEqual(['checkout,v2'])
})
it('carries the window the caller was looking at', () => {
const url = tracingUrlForService('checkout', { dateRange: { date_from: '-30m', date_to: null } })
expect(JSON.parse(paramsOf(url).dateRange)).toEqual({ date_from: '-30m', date_to: null })
})
it('omits the window when the caller has none', () => {
expect(paramsOf(tracingUrlForService('checkout'))).not.toHaveProperty('dateRange')
})
})
})