Skip to content

test(frontend): cover the result-exportation and UI-UDF-parameters templates - #7891

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:cov/result-exportation-templates
Open

test(frontend): cover the result-exportation and UI-UDF-parameters templates#7891
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:cov/result-exportation-templates

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Both workspace templates go to 100% lines, branches and functions. 37 tests → 53.

Measured from frontend/ with ng test --coverage --coverage-reporters=lcovonly, the same spec-file filter on both sides, and rm -rf coverage between runs. lcov parsed with Codecov's model: DA=0 is missed, DA>0 with some BRDA arms at 0 is partial, and partial counts against the percentage.

Template Before After
result-exportation.component.html 60/67 = 89.6%, branches 9/18, functions 4/8 67/67 = 100%, branches 18/18, functions 8/8
ui-udf-parameters.component.html 40/46 = 87.0%, branches 6/8, functions 0/5 46/46 = 100%, branches 8/8, functions 5/5

+13 Codecov fully-covered lines, +11 branch arms, +9 functions.

Worth being precise about where that 13 comes from: the raw lcov line-hit delta is only +5. The other 8 lines move because Codecov counts a line with any unhit branch arm as missed. Both companion .ts files were already at 100% lines, branches and functions before and after, so nothing here is a .ts gain.

The ui-udf-parameters function counter is the one I would point a reviewer at: zero of its five template functions were covered, which an 87% line figure hides entirely.

An existing comment in the spec was wrong, and it was the blocker

result-exportation.component.spec.ts asserted in a comment that the nz-autocomplete option bodies are unreachable — that the option content "only enters the DOM once the autocomplete panel expands, which jsdom does not drive."

That is false. NzAutocompleteTriggerDirective declares a host focusin listener running handleFocus()canOpen()openPanel(), so dispatching new Event("focusin") on the search input and calling detectChanges() attaches the panel. Verified by rendering it: two option nodes, and clicking one fires the export.

Two mechanics that follow, both now in the spec:

  • The options render into the overlay container in document.body, so they are queried with document.querySelectorAll. fixture.debugElement returns zero.
  • The expected count is derived from the component's own filtered list, so a stale overlay from a sibling test cannot make the assertion vacuous.

Verification

30 mutations, all 30 killed, no survivors. Every mutant was re-derived from scratch against the repaired specs, one at a time. This includes all 8 that the two adversarial reviewers reported as surviving the first draft.

Three mutants were discarded as non-viable rather than counted, and by build evidence rather than argument:

  • Two [nzDescription]="…length || null" variants are type-invalidng build rejects them under strictTemplates. A mutant that only fails to compile proves nothing, so they are not in the table either way.
  • Swapping the (keyup.enter) and (keyup.escape) attributes wholesale, event names included, is a pure attribute reorder with no semantic change.

Corrections to the first draft

  • "survivors": [] was true of the table it ran, but that table was defective: two of its fourteen rows were type-invalid mutants and its remaining coverage was too narrow to support the bundle's claims.
  • Two rows presented as proving a || null fallback is load-bearing actually prove only that nz-alert renders a description node; rewritten to say that.
  • The first draft flagged one test as soft, offering to fall back to 12 lines / 10 arms if a reviewer objected. That went the other way on measurement — the test is fine and the fallback is not needed.
  • A note claiming a placeholder branch was "already covered" was wrong; it was not.
  • A droppedTargets entry had correct arithmetic and the wrong conclusion.

Deliberately not included

The "value editable, name and type locked" behaviour cannot be asserted through a rendered formly-field: attaching a real FormControl before render makes FormlyField throw TypeError: Cannot destructure property 'updateOn' of 'field.modelOptions', because fieldChanges() assumes a fully built Formly field. Standing up a full FormlyModule.forRoot form for that is out of scope, and the behaviour is already covered at the unit level by three existing tests. The rendered-row test asserts structure instead.

No production file is touched, and no production seam was needed — every one of the 13 lines was reachable from a test-only change.

Any related issues, documentation, discussions?

Closes #7890

How was this PR tested?

npx ng test --watch=false --include="**/result-exportation.component.spec.ts" --include="**/ui-udf-parameters.component.spec.ts"
 Test Files  2 passed (2)
      Tests  57 passed (57)

jsdom prints two AggregateError blocks from xhr-utils.js during these specs. Those are pre-existing — present identically in the untouched baseline run. frontend/junit.xml and frontend/coverage/ are regenerated by every run and are not committed. yarn format:ci passes.

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

Generated-by: Claude Code (Opus 5)

…mplates

Both templates reach 100% lines, branches and functions. 37 tests to 53.

ui-udf-parameters.component.html had ZERO of its five template functions
covered, which its 87% line figure hid entirely.

The blocker was a wrong comment in the existing spec, which asserted that
the nz-autocomplete option bodies cannot be reached in jsdom because the
panel never expands. NzAutocompleteTriggerDirective has a host focusin
listener, so dispatching focusin attaches the panel -- verified by rendering
it and firing an export from a clicked option. The options land in the
overlay container in document.body, so they are queried through
document.querySelectorAll rather than fixture.debugElement.

30 mutations, all 30 killed. Two candidate mutants were discarded as
type-invalid under strictTemplates -- proven by ng build rather than argued
-- and one as a semantically inert attribute reorder.

Of the +13 Codecov lines, only +5 are raw line-hit; the other 8 move because
Codecov counts a line with any unhit branch arm as missed.
Copilot AI lite review requested due to automatic review settings August 23, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @mengw15
    You can notify them by mentioning @mengw15 in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.22%. Comparing base (65f1f66) to head (0b269b6).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7891      +/-   ##
============================================
+ Coverage     92.09%   92.22%   +0.12%     
  Complexity     4533     4533              
============================================
  Files          1173     1173              
  Lines         47347    47347              
  Branches       5306     5306              
============================================
+ Hits          43604    43665      +61     
+ Misses         2105     2070      -35     
+ Partials       1638     1612      -26     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 65f1f66
agent-service 98.62% <ø> (ø) Carriedforward from 65f1f66
amber 88.76% <ø> (ø) Carriedforward from 65f1f66
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 65f1f66
config-service 86.73% <ø> (ø) Carriedforward from 65f1f66
file-service 75.74% <ø> (ø) Carriedforward from 65f1f66
frontend 94.28% <ø> (+0.29%) ⬆️
notebook-migration-service 79.13% <ø> (ø) Carriedforward from 65f1f66
pyamber 97.52% <ø> (ø) Carriedforward from 65f1f66
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 65f1f66

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

Cover the result-exportation and UI-UDF-parameters templates

3 participants