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.

676 B
Raw Blame
import { PushIdentityVerificationMode, pushIdentityPublicKeyError } from './pushIdentityVerification'

describe('pushIdentityPublicKeyError', () => {
    const key = '-----BEGIN PUBLIC KEY-----\nabc\n-----END PUBLIC KEY-----'

    it.each<[PushIdentityVerificationMode, string, boolean]>([
        ['disabled', '', false],
        ['optional', '', false],
        ['required', '', true],
        ['required', '   \n', true],
        ['optional', key, false],
        ['required', key, false],
    ])('mode %s with key %j reports an error: %s', (mode, publicKey, hasError) => {
        expect(pushIdentityPublicKeyError(mode, publicKey) !== undefined).toBe(hasError)
    })
})