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.

711 B
Raw Blame
import { ActorsQueryResponse } from '~/queries/schema/schema-general'

import { getPersonsFromResponse } from './PersonDisplayNameNudgeBanner'

describe('getPersonsFromResponse', () => {
    it('should not return null values', () => {
        const response = {
            results: [
                [{ display_name: 'John Doe' }],
                [{ display_name: 'Jane Doe' }],
                [null],
                [{ name: 'Wrong name field' }],
                [['This should be an object']],
            ],
        } as ActorsQueryResponse

        const persons = getPersonsFromResponse(response)
        expect(persons).toEqual([{ display_name: 'John Doe' }, { display_name: 'Jane Doe' }])
    })
})