test(frontend): cover the joint graph wrapper's layout and co-editor paths - #7509
Merged
Conversation
…paths joint-graph-wrapper.ts sat at 76.4% lines and 50.6% branches - the branch figure being the real gap, since a line counts as covered with one side of its condition never taken. Adds 20 tests covering absolute positioning, the link cell change stream, auto layout, the co-editor presence rings and their re-padding on delete, the editing banner, and the guard clauses for missing and wrong-typed cells. Lines go to 97.91% and branches to 96.47%. Everything runs under jsdom with no extra infrastructure: a real joint.dia.Paper constructs and renders, findViewByModel returns a real view, the mask highlighters apply, and DirectedGraph.layout runs. No production file is touched.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7509 +/- ##
============================================
- Coverage 86.38% 86.07% -0.32%
+ Complexity 4211 4152 -59
============================================
Files 1169 1169
Lines 46750 46733 -17
Branches 5203 5202 -1
============================================
- Hits 40387 40224 -163
- Misses 4641 4821 +180
+ Partials 1722 1688 -34
*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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
joint-graph-wrapper.tssat at 76.4% lines and 50.6% branches. The branch number is the onethat mattered — half its conditions had only ever been taken one way.
Adds 20 tests to the existing spec, appended as new blocks rather than edits so a rebase stays
cheap (#6489 also touches this file). Covered: absolute positioning, the link-cell change stream,
auto layout, the co-editor presence rings including re-padding when one is deleted, the editing
banner, and the guard clauses for missing and wrong-typed cells.
Verification
46 mutations were applied and reverted, 45 red on the first pass. One survived — the
currentStrokeIds.includes(highlightIdToDelete)guard — and the test was strengthened to assertring order after a ghost delete, which kills it.
Review then found two more problems, both fixed:
"removeCurrentEditing hides the banner and stops the animation"could not fail on the second half:removeCurrentEditingblanks the banner textfirst, so the interval body's ownership check is permanently false and advancing the timers is a
no-op whether or not the interval was cleared.
clearIntervalis already pinned by apre-existing test, so the unfalsifiable half was removed rather than propped up.
|| 0fallback ingetCellLayer; a link'szis explicitly 0, so it only proves a present zero survives.Deliberately not included
getCellLayer's|| 0fallback (line 752) is unreachable, and no test pins it. Mutating it to?? -1survives, and the reason is structural rather than a missing test: joint'sGraph.addCellsets
z = maxZIndex() + 1on any cell that arrives without one, andgetCellLayerthrows for acell that is not in the graph — so
attributes.zis neverundefinedwhere it is read. Deletingthe
|| 0outright does not compile (zisnumber | undefined), so it is load-bearing for typingonly. That is recorded in the spec so the next reader does not re-derive it.
Also left alone: the link-breakpoint members.
jointLinkBreakpointShowStreamandjointLinkBreakpointHideStreamare private Subjects never.next()-ed anywhere infrontend/src,and
linksWithBreakpointsis declared and read but never written.No production file is touched.
Any related issues, documentation, discussions?
Closes #7508
How was this PR tested?
20 new on top of the existing 47.
yarn format:cipasses.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)