Repository navigation
test(renderer): add unit tests for the login validation utils - #3415
Merged
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds a colocated unit test for
utils/auth/loginValidation.ts. It was the onlyutils/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.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 secretsummarizeLoginError— first-line only, whitespace collapse, 150-char cap, non-errorscomponents/login/LoginWithPersonalAccessTokenForm.test.tsx, whose only content (summarizeLoginError) moved to the new module test.No production code change.
Verification
tsc --noEmit— cleanpnpm check(format + lint) — cleanpnpm test— 187 files, 1899 tests passing