Skip to content

test(frontend): extend UserDatasetFileRendererComponent unit test coverage#6816

Open
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test-fe-file-renderer
Open

test(frontend): extend UserDatasetFileRendererComponent unit test coverage#6816
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test-fe-file-renderer

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends user-dataset-file-renderer.component.spec.ts with 15 tests (18 -> 33), covering ngOnChanges reload triggers, object-URL revocation on destroy / turn-off, the file-type viewer selection switch (image / mp4 / mp3 / markdown / json / csv, with CSV parsed into a table), and the in-callback oversize and unsupported-preview guards. Coverage 69% -> 92% lines. No existing tests modified.

Any related issues, documentation, discussions?

Closes #6812.

How was this PR tested?

ng test --include='**/user-dataset-file-renderer.component.spec.ts' -> 33/33 passing. yarn format:ci passes.

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

Generated-by: Claude Code (Opus 4.8 [1M context])

…erage

Add 15 tests covering ngOnChanges reload triggers, object-URL revocation on
destroy/turn-off, the file-type viewer selection (image/mp4/mp3/markdown/json/csv),
and the oversize/unsupported-preview guards. Coverage 69% -> 92%.
Copilot AI review requested due to automatic review settings July 23, 2026 05:03
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 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.

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

This PR expands frontend unit test coverage for UserDatasetFileRendererComponent to better exercise lifecycle-triggered reload behavior, object URL cleanup, viewer selection logic across multiple file types, and defensive guards for oversize/unsupported previews.

Changes:

  • Added ngOnChanges tests to confirm reload triggers for filePath changes and the (did + dvid) pair, and non-triggers for unrelated/partial changes.
  • Added cleanup tests verifying object-URL revocation in ngOnDestroy and turnOffAllDisplay.
  • Added reloadFileContent tests covering viewer selection for image/video/audio/markdown/json/csv, plus oversized/unsupported-blob guard behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.71%. Comparing base (110a54c) to head (f91e3f4).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6816      +/-   ##
============================================
+ Coverage     76.27%   76.71%   +0.44%     
  Complexity     3452     3452              
============================================
  Files          1161     1161              
  Lines         45919    45920       +1     
  Branches       5100     5100              
============================================
+ Hits          35025    35228     +203     
+ Misses         9329     9159     -170     
+ Partials       1565     1533      -32     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 2a95289
agent-service 76.76% <ø> (ø) Carriedforward from 2a95289
amber 67.33% <ø> (ø) Carriedforward from 2a95289
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from 2a95289
config-service 66.66% <ø> (ø) Carriedforward from 2a95289
file-service 67.21% <ø> (ø) Carriedforward from 2a95289
frontend 82.71% <ø> (+1.00%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 2a95289
pyamber 92.15% <ø> (ø) Carriedforward from 2a95289
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 2a95289

*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.

@aglinxinyuan

Copy link
Copy Markdown
Contributor Author

Closing as it doesn't increase coverage

@aglinxinyuan
aglinxinyuan requested a review from mengw15 July 23, 2026 23:50
@aglinxinyuan aglinxinyuan reopened this Jul 23, 2026
@aglinxinyuan

Copy link
Copy Markdown
Contributor Author

It actually increase the coverage.

Use realistic SimpleChange(previous, current, firstChange) inputs for the
ngOnChanges tests instead of empty {} placeholders, set safeFileURL to an object
with a toString() (matching the SafeUrl runtime) rather than a raw string cast,
and drop the undefined-as-never cast on the notification warning spy.
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.

Extend UserDatasetFileRendererComponent unit test coverage

3 participants