Skip to content

test: unit tests for LocalLoginComponent#5235

Open
Ma77Ball wants to merge 4 commits into
apache:mainfrom
Ma77Ball:test/localLoginSpec
Open

test: unit tests for LocalLoginComponent#5235
Ma77Ball wants to merge 4 commits 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
@Ma77Ball
Copy link
Copy Markdown
Contributor Author

/request-review @Yicong-Huang

@github-actions github-actions Bot requested a review from Yicong-Huang May 26, 2026 21:46
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.95%. Comparing base (d8c254c) to head (3617679).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5235      +/-   ##
============================================
- Coverage     48.93%   45.95%   -2.99%     
+ Complexity     2373     2214     -159     
============================================
  Files          1048     1049       +1     
  Lines         40270    40655     +385     
  Branches       4272     4332      +60     
============================================
- Hits          19708    18684    -1024     
- Misses        19405    20841    +1436     
+ Partials       1157     1130      -27     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 0bce181
agent-service 33.74% <ø> (-0.03%) ⬇️ Carriedforward from 0bce181
amber 44.07% <ø> (-7.46%) ⬇️ Carriedforward from 0bce181
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 0bce181
config-service 0.00% <ø> (ø) Carriedforward from 0bce181
file-service 32.09% <ø> (-5.90%) ⬇️ Carriedforward from 0bce181
frontend 40.85% <ø> (+0.20%) ⬆️
python 90.45% <ø> (-0.35%) ⬇️ Carriedforward from 0bce181
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 0bce181

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chenlica chenlica requested a review from Xiao-zhen-Liu May 28, 2026 00:06
@chenlica
Copy link
Copy Markdown
Contributor

@Xiao-zhen-Liu Please review this PR.

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

3 participants