: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 { Scope } from '../../scope'
import { LiteralExpr } from './literal'
import { ObjectExpr } from './object'
import { PathExpr } from './path'
describe('ObjectExpr', () => {
it('evaluates each field into an object', () => {
const scope = Scope.forNode({ name: 'Ada' }, 'user')
const expr = new ObjectExpr({ kind: new LiteralExpr('person'), label: new PathExpr(['name']) })
expect(expr.eval(scope)).toEqual({ kind: 'person', label: 'Ada' })
})
it('empty spec yields an empty object', () => {
expect(new ObjectExpr({}).eval(Scope.forNode({}, 'user'))).toEqual({})
})
})