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.

874 B
Raw Blame
import { otherRegionLoginUrl, otherRegionOf } from 'scenes/authentication/shared/otherRegion'

import { Region } from '~/types'

describe('otherRegion', () => {
    test.each([
        ['US points to EU', Region.US, Region.EU],
        ['EU points to US', Region.EU, Region.US],
    ])('otherRegionOf: %s', (_name, region, expected) => {
        expect(otherRegionOf(region)).toEqual(expected)
    })

    test.each([
        ['US with no query lands on eu login', Region.US, '', 'https://eu.posthog.com/login'],
        ['EU with no query lands on us login', Region.EU, '', 'https://us.posthog.com/login'],
        ['preserves the next query param', Region.US, '?next=/home', 'https://eu.posthog.com/login?next=/home'],
    ])('otherRegionLoginUrl: %s', (_name, region, search, expected) => {
        expect(otherRegionLoginUrl(region, search)).toEqual(expected)
    })
})