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.

1.0 KB
Raw Blame
import { SIDEBAR_PRODUCTS_WITHOUT_DOCS, sidebarProductMeta } from '~/layout/panel-layout/sidebarProductMeta'
import { getTreeItemsProducts } from '~/products'

describe('sidebarProductMeta', () => {
    const products = getTreeItemsProducts()

    it.each(products.map((product) => [product.path, product] as const))(
        '%s explains itself in sidebar settings',
        (path, product) => {
            const { description, docsHref } = sidebarProductMeta(product)
            expect(description).toBeTruthy()
            if (!SIDEBAR_PRODUCTS_WITHOUT_DOCS.has(path)) {
                expect(docsHref).toMatch(/^https:\/\/posthog\.com\/docs\//)
            }
        }
    )

    it('only exempts products that are still missing a docs page', () => {
        const stale = [...SIDEBAR_PRODUCTS_WITHOUT_DOCS].filter((path) => {
            const product = products.find((candidate) => candidate.path === path)
            return !product || sidebarProductMeta(product).docsHref
        })
        expect(stale).toEqual([])
    })
})