: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 { templateLibraryUrl, templateSectionFor, templateUrlInSection } from './templateSection'
describe('templateSection', () => {
test.each([
['/project/2/transactional/library', '/transactional/library/templates/t1', '/transactional/library'],
[
'/project/2/transactional/library/templates/t9',
'/transactional/library/templates/t1',
'/transactional/library',
],
['/project/2/broadcasts/library', '/broadcasts/library/templates/t1', '/broadcasts/library'],
['/project/2/workflows/library', '/workflows/library/templates/t1', '/workflows/library'],
// A path that only shares the prefix is not the Transactional section.
['/project/2/transactionalish/library', '/workflows/library/templates/t1', '/workflows/library'],
])('opened from %s keeps links in its section', (pathname, expectedTemplateUrl, expectedLibraryUrl) => {
const section = templateSectionFor(pathname)
expect(templateUrlInSection('t1', section)).toBe(expectedTemplateUrl)
expect(templateLibraryUrl(section)).toBe(expectedLibraryUrl)
})
})