test(frontend): render ConsoleFrameComponent template branches for coverage - #7333
test(frontend): render ConsoleFrameComponent template branches for coverage#7333mengw15 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Extends ConsoleFrameComponent unit tests to render and exercise template branches (*ngFor, *ngIf, click handlers, and command input submission) that were previously untested, improving coverage without changing production code.
Changes:
- Added template-rendering tests covering message rows, collapse vs plain title branches, and conditional tags (source/timestamp/worker).
- Added tests for toggling
showSource/showTimestampoff to hit*ngIffalse branches. - Added tests for debug input group presence/absence and basic button/cmd wiring when enabled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Assert the ALL_WORKERS broadcast reaches every worker id (the test set
targetWorker=ALL_WORKERS but only checked w-0, missing w-1).
- Assert the collapse-message-header element exists before reading its text.
- Pass null (not {}) to triggerEventHandler — the handlers don't read the event.
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7333 +/- ##
============================================
+ Coverage 83.36% 83.49% +0.13%
Complexity 4128 4128
============================================
Files 1166 1166
Lines 46428 46428
Branches 5174 5174
============================================
+ Hits 38705 38767 +62
+ Misses 6003 5941 -62
Partials 1720 1720
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What changes were proposed in this PR?
Extends the
ConsoleFrameComponentspec so its template actually renders,covering the
.component.htmlbranches the class-level tests never exercised(
frontend/src/app/workspace/component/result-panel/console-frame/). The classwas already well covered; only the template was low. No production code changed.
+4 tests, each seeding component state then calling
detectChanges()so thetemplate executes:
*ngForlist, the collapse panel (non-emptymessage) vs the plain-title branch (empty message), and the source / timestamp /
worker tags. Only the message that carries a
workerIdrenders the worker tag.showSource/showTimestamparetoggled off (the
*ngIffalse arms).consoleInputEnabledis false and presentwhen true; clicking each of the four action buttons reaches its handler, and
pressing enter in the command input submits the command through the websocket.
Per the component's determinism constraints:
| datepipe but its formattedstring is not asserted (it is timezone-dependent under a UTC CI runner) —
the assertions check the tag's presence and other cell text instead;
ngAfterViewCheckedauto-scrollsetTimeout(a synchronous test body never lets it fire), and nothing assertson layout/geometry (
scrollHeightetc., which are zero under jsdom).Any related issues, documentation, discussions?
Closes #7329
How was this PR tested?
Extended unit tests, run locally in
frontend/(all green; the failure path wasverified by breaking an assertion to confirm the suite goes red):
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])