Skip to content

test(auth): add regression coverage for i18n across the auth flow (#159) - #176

Merged
datvt243 merged 1 commit into
stagingfrom
159-i18n-for-api
Sep 30, 2026
Merged

datvt243 merged 1 commit into
stagingfrom
159-i18n-for-api

Conversation

@datvt243

Copy link
Copy Markdown
Owner

Commits going into staging

Summary

The i18n infrastructure (utils/i18n.ts, locales/{vi,en}.ts, language.middleware.ts) and the full auth-flow migration (register/login/logout/refresh/forgot-password/reset-password/verify-email) were already implemented and live — all 21 message sites already resolve through t(). This adds the missing regression tests: unit tests for t()/tErrorType(), unit tests for languageMiddleware's Accept-Language resolution, and 5 new English-language cases at the auth-controller boundary proving req.lang drives real localized output. 0 production code changed.

Closes #159.

🤖 Generated with Claude Code

i18n infra (utils/i18n.ts's t()/tErrorType(), locales/{vi,en}.ts,
language.middleware.ts) and the full auth-flow migration (register/
login/logout/refresh/forgot-password/reset-password/verify-email, all
21 message sites) were already implemented and live. Adds the missing
regression tests:

- src/__tests__/utils/i18n.test.ts (new): unit tests for t()/tErrorType()
  — per-language resolution, default-lang fallback, key-as-fallback,
  flat vs dot-path lookup.
- src/__tests__/middlewares/language.test.ts (new): unit tests for
  languageMiddleware's Accept-Language resolution (plain/regional/
  multi-tag/case-insensitive/unsupported) and req.t() wiring.
- src/__tests__/auth/auth.controller.test.ts (extended): 5 new
  English-language cases proving req.lang drives real (unmocked) t()
  output at the controller boundary, alongside the pre-existing
  vi-default cases.

0 production code changed.

npm test: 31 suites / 181 tests passed.
npm run build: clean.

Sealed node: feat-i18n-api-messages-auth
Evidence: agent-hub/evidence/implementer/2026-10-01/feat-i18n-api-messages-auth-plan.md,
          agent-hub/evidence/verifier/2026-10-01/feat-i18n-api-messages-auth-seal.md

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Sep 30, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
29571135 Triggered Generic Password 9d4b69a src/tests/auth/auth.controller.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@datvt243
datvt243 merged commit 4dc068a into staging Sep 30, 2026
3 checks passed
@datvt243
datvt243 deleted the 159-i18n-for-api branch September 30, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant