Skip to content

test: unit tests for LocalLoginComponent#5235

Open
Ma77Ball wants to merge 1 commit into
apache:mainfrom
Ma77Ball:test/localLoginSpec
Open

test: unit tests for LocalLoginComponent#5235
Ma77Ball wants to merge 1 commit into
apache:mainfrom
Ma77Ball:test/localLoginSpec

Conversation

@Ma77Ball
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Add local-login.component.spec.ts to cover form construction, validators, default-user prefill, and the login/register flows that were previously untested.
  • Tests assert that allForms exposes the five expected controls with required, minLength(6), and the custom confirmationValidator, that confirmationValidator returns { confirm: true } on mismatch and {} on match, and that updateConfirmValidator schedules updateValueAndValidity on the confirmation control via setTimeout.
  • Tests assert that ngOnInit patches loginUsername/loginPassword only when GuiConfigService.env.defaultLocalUser is populated, that login short-circuits via loginErrorMessage on validation failure and otherwise calls UserService.login with the trimmed username and navigates to queryParams.returnUrl or DASHBOARD_USER_WORKFLOW, and that error paths surface the error's message (or the fallback "Incorrect username or password") through NotificationService.error.
  • Tests assert that register enforces password length, password match, and UserService.validateUsername, calls UserService.register with the trimmed username on success and surfaces the account-created notification, and on error notifies with the error's message (or the fallback "Registration failed").

Any related issues, documentation, or discussions?

Closes: #5226

How was this PR tested?

  • yarn test --include="src/app/hub/component/about/local-login/local-login.component.spec.ts", 22 tests passing.
  • yarn format:fix, 506 files unchanged.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.7 in compliance with ASF

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add spec coverage for local-login.component.ts

1 participant