Files
template-app/test/auth-errors.test.ts
T
2026-11-14 09:56:45 +00:00

19 lines
899 B
TypeScript

// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// The words for each sign-in failure's code. Which code a failure gets, and where it may redirect to,
// are `@conusai-kit/host/postgres`'s, with their tests (kit-host `auth-errors.test.ts`).
import { describe, expect, it } from "vitest"
import { AUTH_ERROR_MESSAGES, AUTH_ERRORS } from "../apps/web/src/server/auth-errors.js"
import { appCatalogues } from "../apps/web/src/ui/messages.js"
describe("the words for each code", () => {
it("exist in English and in Lithuanian for every code", () => {
for (const code of AUTH_ERRORS) {
const [module, ...rest] = (AUTH_ERROR_MESSAGES[code] as string).split(".")
const key = rest.join(".")
expect(appCatalogues.en?.[module as string]?.[key], `en ${code}`).toBeTruthy()
expect(appCatalogues.lt?.[module as string]?.[key], `lt ${code}`).toBeTruthy()
}
})
})