Skip to content

test(renderer): add unit tests for the login validation utils - #3415

Merged
setchy merged 1 commit into
mainfrom
test/login-validation-utils
Oct 14, 2026
Merged

setchy merged 1 commit into
mainfrom
test/login-validation-utils

Conversation

@setchy

@setchy setchy commented Oct 14, 2026

Copy link
Copy Markdown
Member

Summary

Adds a colocated unit test for utils/auth/loginValidation.ts. It was the only utils/ module without one — its functions were exercised only from route and component test files, which is the same "logic tested from the presentation layer" shape the #3413 refactor removed from the source.

  • Adds utils/auth/loginValidation.test.ts, covering:
    • validatePersonalAccessTokenForm — missing/invalid fields, the Bitbucket email requirement, and the per-forge hostname rules (Gitea ports/origins, HTTPS-only, GitLab/Gitea token formats)
    • validateOAuthAppForm — missing/invalid hostname, client ID, and client secret
    • summarizeLoginError — first-line only, whitespace collapse, 150-char cap, non-errors
  • Moves the pure validator/summary cases out of the route and component tests, so those files keep only their rendering/integration coverage.
  • Deletes components/login/LoginWithPersonalAccessTokenForm.test.tsx, whose only content (summarizeLoginError) moved to the new module test.

No production code change.

Verification

  • tsc --noEmit — clean
  • pnpm check (format + lint) — clean
  • pnpm test — 187 files, 1899 tests passing

utils/auth/loginValidation.ts was the only utils module without a colocated
test; its pure functions were only exercised from route and component test
files.

- Add utils/auth/loginValidation.test.ts covering validatePersonalAccessTokenForm
  (incl. per-forge hostname rules and Bitbucket/GitLab/Gitea cases),
  validateOAuthAppForm, and summarizeLoginError
- Move the pure validator/summary cases out of the route and form tests, so
  those files keep only their rendering/integration coverage
- Delete the PAT form test file, whose only content (summarizeLoginError) moved
  to the new module test
@setchy
setchy requested a review from afonsojramos as a code owner October 14, 2026 11:27
@github-actions github-actions Bot added the test Enhancements to test coverage or quality label Oct 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

@setchy
setchy merged commit f61ec82 into main Oct 14, 2026
18 checks passed
@setchy
setchy deleted the test/login-validation-utils branch October 14, 2026 11:30
@github-actions github-actions Bot added this to the Release 7.10.0 milestone Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Enhancements to test coverage or quality

Development

Successfully merging this pull request may close these issues.

1 participant