Skip to content

test(frontend): add unit tests for ReportGenerationService#6471

Open
Ma77Ball wants to merge 4 commits into
apache:mainfrom
Ma77Ball:test/report-generation-service-spec
Open

test(frontend): add unit tests for ReportGenerationService#6471
Ma77Ball wants to merge 4 commits into
apache:mainfrom
Ma77Ball:test/report-generation-service-spec

Conversation

@Ma77Ball

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Adds report-generation.service.spec.ts covering ReportGenerationService; no production code changed.
  • Verifies the AI comment and summary prompt builders and the workflow-snapshot capture (found and not-found).
  • Covers the operator-result HTML generation branches (empty, table data, no service, error).

Any related issues, documentation, discussions?

Closes: #6459

How was this PR tested?

  • Run cd frontend && npx nx test gui --include="**/report-generation.service.spec.ts", expect 10 passed.
  • Full frontend suite runs in CI via yarn test:ci, selected by the auto-applied frontend label.

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

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 16, 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:

  • No candidates found from git blame history.

@codecov-commenter

codecov-commenter commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.36%. Comparing base (c7473a1) to head (e579bb3).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6471      +/-   ##
============================================
+ Coverage     70.20%   70.36%   +0.15%     
  Complexity     3390     3390              
============================================
  Files          1142     1142              
  Lines         44844    44871      +27     
  Branches       4949     4955       +6     
============================================
+ Hits          31484    31572      +88     
+ Misses        11725    11662      -63     
- Partials       1635     1637       +2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 358b664
agent-service 76.76% <ø> (ø) Carriedforward from 358b664
amber 66.68% <ø> (ø) Carriedforward from 358b664
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from 358b664
config-service 52.30% <ø> (ø) Carriedforward from 358b664
file-service 65.63% <ø> (ø) Carriedforward from 358b664
frontend 69.33% <ø> (+0.36%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 358b664
pyamber 91.19% <ø> (ø) Carriedforward from 358b664
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 358b664

*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

Adds a new Vitest unit test suite for the frontend ReportGenerationService to improve confidence in report generation behaviors without modifying production code.

Changes:

  • Added report-generation.service.spec.ts covering AI prompt construction for comment + summary generation.
  • Added coverage for operator-result HTML generation for: missing result service, empty paginated results, non-empty paginated results (table), and paginated-service error handling.
  • Added coverage for the workflow snapshot precondition error when #workflow-editor is missing.

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

Comment on lines +100 to +107
describe("generateWorkflowSnapshot", () => {
// The rendering path delegates to html2canvas (unmockable reliably under the
// shared module registry), so only the pre-render guard is pinned here.
it("errors when the #workflow-editor element is absent", () => {
let error: unknown;
service.generateWorkflowSnapshot("wf").subscribe({ error: (e: unknown) => (error = e) });
expect(error).toEqual("Workflow editor element not found");
});
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 frontend unit tests for ReportGenerationService

3 participants