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.2 KB
Raw Blame
import { FlagEvaluationsMode, ProjectId, Team } from '../../src/types'

export const INVALID_TEAM_ID_KEYS = ['abc', '1.5', '3000000000', '0', '-1', '', 'undefined', 'NaN']

/**
 * Helper function to create a Team object for tests with sensible defaults.
 *
 * @param overrides - Partial Team to override defaults
 * @returns Complete Team object
 */
export function createTestTeam(overrides: Partial<Team> = {}): Team {
    return {
        id: 1,
        uuid: 'test-team-uuid',
        organization_id: 'test-org-id',
        name: 'Test Team',
        api_token: 'test-token',
        secret_api_token: null,
        anonymize_ips: false,
        session_recording_opt_in: false,
        person_processing_opt_out: null,
        heatmaps_opt_in: null,
        ingested_event: true,
        person_display_name_properties: null,
        minimal_flag_called_events: false,
        flag_evaluations_mode: FlagEvaluationsMode.Events,
        test_account_filters: null,
        cookieless_server_hash_mode: null,
        timezone: 'UTC',
        available_features: [],
        drop_events_older_than_seconds: null,
        extra_settings: null,
        project_id: 1 as unknown as ProjectId,
        ...overrides,
    }
}