: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 { HogFunctionType } from '~/types'
import { urlForHogFunction } from './HogFunctionsList'
const makeFn = (id: string): HogFunctionType => ({ id }) as HogFunctionType
describe('urlForHogFunction', () => {
it('returns the bare hog function path when returnTo is undefined', () => {
expect(urlForHogFunction(makeFn('abc123'))).toBe('/functions/abc123')
})
it('appends returnTo as a query param for a hog function id', () => {
expect(urlForHogFunction(makeFn('abc123'), '/health/sdk-health')).toBe(
'/functions/abc123?returnTo=%2Fhealth%2Fsdk-health'
)
})
it('does not append returnTo for plugin- prefix IDs', () => {
expect(urlForHogFunction(makeFn('plugin-7'), '/health/sdk-health')).toBe('/pipeline/plugins/7')
})
})