Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

696 B
Raw Blame
import { describe, expect, it } from 'vitest'
import { authCallbackErrorKey } from './use-auth-providers'

describe('authCallbackErrorKey', () => {
  it('maps a known callback error code to its copy', () => {
    expect(authCallbackErrorKey('account_not_provisioned')).toBe(
      'admin.auth.login.account_not_provisioned',
    )
    expect(authCallbackErrorKey('account_deactivated')).toBe('admin.auth.login.account_deactivated')
  })

  it('falls back to the generic message for unknown and inherited names', () => {
    for (const code of ['something_else', 'constructor', '__proto__', 'toString']) {
      expect(authCallbackErrorKey(code)).toBe('admin.auth.login.sso_failed')
    }
  })
})