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.

596 B
Raw Blame
import { Scope } from '../../scope'
import { ArrayExpr } from './array'
import { LiteralExpr } from './literal'
import { PathExpr } from './path'

describe('ArrayExpr', () => {
    it('evaluates each element against the scope', () => {
        const scope = Scope.forNode({ name: 'Ada' }, 'user')
        const expr = new ArrayExpr([new LiteralExpr('greeting'), new PathExpr(['name'])])
        expect(expr.eval(scope)).toEqual(['greeting', 'Ada'])
    })

    it('empty spec yields an empty array', () => {
        expect(new ArrayExpr([]).eval(Scope.forNode({}, 'user'))).toEqual([])
    })
})