test(app): raise packages/app UI coverage with component and unit tests (RHIDP-13853)#4865
test(app): raise packages/app UI coverage with component and unit tests (RHIDP-13853)#4865gustavolira wants to merge 4 commits into
Conversation
Net-new unit/component tests for previously-untested packages/app modules (RHIDP-13853, UI coverage): - LearningPathApiClient: URL building (default + configured proxy path), bearer-token header presence/absence, and the non-ok error path. - MenuIcon: empty icon, registered system icon, inline SVG (base64 image), URL icon, and material icon name branches. - GoBackButton: navigates back when history exists, renders nothing otherwise. - ContactSupportButton: prop > configured URL > default fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net-new component tests for previously-untested packages/app UI (RHIDP-13853): - ErrorPage: status/message/info rendering, the always-present contact-support action, stack-trace rendering, and no go-back action for non-404 errors. - ResizableDrawer: children render while open, resize listeners are registered when resizable, and a resize drag reports the new width. - SignInPage: proxied vs local provider selection, guest provider added in development only, default-to-github when unset or unknown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4865 +/- ##
===========================================
+ Coverage 41.03% 72.67% +31.63%
===========================================
Files 121 111 -10
Lines 2220 4724 +2504
Branches 562 535 -27
===========================================
+ Hits 911 3433 +2522
+ Misses 1304 1291 -13
+ Partials 5 0 -5
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
- ErrorPage: assert the go-back action appears for 404 errors when there is history (the 404 branch), bringing the file to 100% coverage. - ResizableDrawer: assert a mouse-up ends the drag so a later mouse-move is ignored, covering the mouse-up handler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The container image build workflow finished with status: |
- ResizableDrawer: assert the resize handle is found before dispatching (so the mouse-up test cannot pass for the wrong reason), and add a rerender-based test for the re-clamp-below-minimum branch — the file is now 100% line-covered. - ErrorPage / GoBackButton: restore window.history.length after each test so the history-dependent cases are reorder-safe. - GoBackButton: drop the redundant MemoryRouter wrapper (useNavigate is mocked). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The container image build workflow finished with status: |
|
There was a problem hiding this comment.
Do we really need to tests for button that just calls navigate(-1);?
This feels like writing tests only for sake of writing tests and increasing coverage numbers rather than providing actual value.
There was a problem hiding this comment.
It was already written so we can keep it. But I don't think that it makes much sense to test functions like this.
ContactSupportButton and ErrorPage are similar stories.
There was a problem hiding this comment.
Do we really need to tests for button that just calls
navigate(-1);?This feels like writing tests only for sake of writing tests and increasing coverage numbers rather than providing actual value.
The real value there is the conditional rendering, not the click itself
There was a problem hiding this comment.
It was already written so we can keep it. But I don't think that it makes much sense to test functions like this.
ContactSupportButtonandErrorPageare similar stories.
Agree they're simple components, but ContactSupportButton has a 3-level fallback (prop, config, default URL) that can break silently, and ErrorPage has conditional logic worth covering. Not strictly required, but I think they add some value.



Description
Implements RHIDP-13853 — raises
packages/appUI coverage by adding Layer 3 component/unit tests for previously-untested modules that carried the most uncovered lines (identified via Codecov). Complements RHIDP-13235 (which only covers behaviors mirrored by existing UI E2E specs).Tests added (target → coverage)
api/LearningPathApiClient.tscomponents/Root/MenuIcon.tsxcomponents/ErrorPages/errorButtons/GoBackButton.tsxcomponents/ErrorPages/errorButtons/ContactSupportButton.tsxcomponents/ErrorPages/ErrorPage.tsxcomponents/SignInPage/SignInPage.tsxcomponents/Root/ResizableDrawer.tsxWhat the tests assert:
Out of scope
Root.tsx(~130 uncovered lines) is the largest remaining target but high-effort (full sidebar nav) — left as a follow-up.DynamicRoot.tsxreports 0% despite having a test (lazy-import coverage-instrumentation artifact) — separate investigation.apis.tsfactory wiring — low value.Testing
tsc, lint and prettier passrhdhflag