Skip to content

Add spec coverage for local-login.component.ts #5226

@Ma77Ball

Description

@Ma77Ball

Task Summary

Create local-login.component.spec.ts for frontend/src/app/hub/component/about/local-login/local-login.component.ts.

Behavior to cover:

  • Form construction — allForms includes loginUsername, registerUsername, loginPassword, registerPassword, registerConfirmationPassword with the correct validators (required, minLength(6), and the custom confirmationValidator).
  • confirmationValidator — returns { confirm: true } when registerConfirmationPassword differs from registerPassword, {} otherwise.
  • updateConfirmValidator — schedules updateValueAndValidity on registerConfirmationPassword via setTimeout.
  • ngOnInit — when GuiConfigService.env.defaultLocalUser has keys, patches loginUsername and loginPassword from it.
  • login — short-circuits and sets loginErrorMessage when UserService.validateUsername fails; otherwise calls UserService.login(username.trim(), password), navigates to queryParams.returnUrl or DASHBOARD_USER_WORKFLOW on success, and on error calls NotificationService.error with the error's message or "Incorrect username or password".
  • register — validates password length ≥ 6, password match, and validateUsername; on success calls UserService.register and surfaces a success notification; on error surfaces NotificationService.error with the error message or "Registration failed".

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions