: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 { render } from '@testing-library/react'
import { setLatestVersionsOnQuery } from '~/queries/schema/query-versions'
import { DataTableNode, NodeKind } from '~/queries/schema/schema-general'
import { renderColumnMeta } from './renderColumnMeta'
const personsTable = setLatestVersionsOnQuery({
kind: NodeKind.DataTableNode,
source: { kind: NodeKind.ActorsQuery, select: [] },
}) as DataTableNode
function headerText(key: string): string {
const { title } = renderColumnMeta(key, personsTable)
return render(<>{title}</>).container.textContent ?? ''
}
describe('renderColumnMeta', () => {
it.each([
["properties.plan_tier ? 'paid' : 'free' -- Plan", 'Plan'],
["properties.$browser IN ('Chrome', 'Firefox') ? 'yes' : 'no' -- Major browser", 'Major browser'],
['person.properties.signup_source -- Acquisition', 'Acquisition'],
["concat(properties.first_name, ' ', properties.last_name) -- Full name", 'Full name'],
['person_display_name -- Person', 'Person'],
])('shows the trailing comment as the header for %s', (key: string, expected: string): void => {
expect(headerText(key)).toBe(expected)
})
it.each([
['properties.plan_tier', 'plan_tier'],
['person.properties.signup_source', 'signup_source'],
])('shows the property name for %s', (key: string, expected: string): void => {
expect(headerText(key)).toBe(expected)
})
})