Skip to content

Batch B (part 5): a test that passed for the opposite reason - #160

Merged
roncodes merged 1 commit into
test/coverage-campaignfrom
test/coverage-batch-b5
Aug 25, 2026
Merged

Batch B (part 5): a test that passed for the opposite reason#160
roncodes merged 1 commit into
test/coverage-campaignfrom
test/coverage-batch-b5

Conversation

@roncodes

Copy link
Copy Markdown
Member

Two files. Stacked on #159 — review that one first.

addon/  1 file  +1  -0     ← one exclusion comment
tests/  2 files +45 -2
DEFECTS.md      +41

5054 pass / 0 fail / 0 skip. Branches 91.14% (from 91.07%), lines 95.07%.

file gaps before after
country-select 9 6
coordinates-input 9 7

The find here is a pre-existing test, not a coverage number

coordinates-input's "a geocoder response with no place reports nothing" primed fetch.responses['geocoder/query'] = null. But the dummy fetch service resolves responses[path] ?? [], so place was a truthy empty array:

  • if (place) was taken, not skipped
  • place.location.coordinates threw
  • the catch swallowed it
  • onGeocode was never called — so the assertion passed

The test asserts the right outcome for the opposite reason to the one it states, and the guard it names had never executed. It now overrides get to resolve null, asserts the null comes back uncoerced, and actually exercises the guard.

A third category in DEFECTS.md

That makes three tests found passing for a reason other than the one they name, now catalogued together:

test claims actually
coordinates-input "no place reports nothing" the if (place) guard skips it stub coerced null[], so it threw and the catch swallowed it
chat-tray "every channel-shaped event is handled" events are handled unmatched names fall through the switch
filters-picker "an empty url value is treated as no value" the component normalises it getUrlParam does, one layer down (benign)

These are worse than an uncovered branch. An uncovered branch is visibly untested; a green test that describes behaviour it doesn't exercise will keep passing when that behaviour breaks. None are findable from a passing suite — only from reading branch counts against test intent.

A reusable trap worth knowing

tests/dummy/app/services/fetch.js resolves responses[path] ?? [], so the stub cannot express "resolved with nothing". Any test needing a falsy response must override get directly. Two tests in this repo primed null and silently received [].

Tests added

  • a failed country lookup leaving an empty list — asserting on power-select's "No results found", which it renders as an option, so doesNotExist was the wrong assertion;
  • selecting a country with no @onChange;
  • a successful geocode with no @onGeocode.

New defect: #12 — ten now open

country-select's changed action is wired to nothing. The template uses handleChange for did-update and selectCountry for PowerSelect's @onChange, and yields nothing, so no consumer can reach it either.

Fourth instance of the orphaned-duplicate shape (#6, #9, #10, #12) — a second implementation sitting beside the one the template actually uses. Ten dead-code items now open; six are zero- or low-risk to delete.

My own process, recorded

Three attempts at one test here. The first approach was right and I abandoned it over an unrelated error inside it — the useful question when a fix fails is which part was wrong. After three tangled edits, git checkout HEAD -- and one careful pass was cheaper than re-reading my own half-applied changes.

…site reason

country-select 9 gaps -> 6, coordinates-input 9 -> 7. Branches 91.14%.

The substantive find is a pre-existing test, not a coverage number.

`coordinates-input`'s "a geocoder response with no place reports nothing" primed
`fetch.responses['geocoder/query'] = null`. The dummy fetch service resolves
`responses[path] ?? []`, so `place` was a TRUTHY empty array: `if (place)` was taken,
`place.location.coordinates` threw, the catch swallowed it, and `onGeocode` was never
called. The assertion passed — for the opposite reason to the one it states — and the guard
it names had never executed. It now overrides `get` to resolve null, asserts the null comes
back uncoerced, and actually exercises the guard.

That makes three tests found passing for a reason other than the one they name, now
catalogued in DEFECTS.md as their own category. They are worse than an uncovered branch: a
green test that describes behaviour it does not exercise will keep passing when that
behaviour breaks. None are findable from a passing suite.

A reusable trap behind two of them: `responses[path] ?? []` means the dummy fetch service
CANNOT express "resolved with nothing". Any test needing a falsy response must override
`get` directly.

Tests added: a failed country lookup leaving an empty list (asserting on power-select's
"No results found", which it renders AS an option); selecting a country with no @onchange;
and a successful geocode with no @onGeocode.

Exclusion: country-select's `fetchCountries(value = null)` — the constructor is the only
caller and always passes it.

DEFECTS.md #12: country-select's `changed` action is wired to nothing. The template uses
`handleChange` for did-update and `selectCountry` for PowerSelect's @onchange, and yields
nothing, so no consumer can reach it either. Fourth instance of the orphaned-duplicate shape
(#6, #9, #10), and ten dead-code items are now open.

Also recorded: I took three attempts at one test here. The first approach was right and I
abandoned it over an unrelated error inside it; I should have asked which PART was wrong.
After three tangled edits, reverting the file and doing one careful pass was cheaper than
re-reading my own half-applied changes.

Full suite 5054 pass / 0 fail / 0 skip.
Coverage 94.69% statements, 91.14% branches, 97.53% functions, 95.07% lines.
@roncodes
roncodes force-pushed the test/coverage-batch-b4 branch from 6e5bb78 to 1740de5 Compare August 22, 2026 04:18
@roncodes
roncodes force-pushed the test/coverage-batch-b5 branch from e73e739 to bf0ad96 Compare August 22, 2026 04:18
Base automatically changed from test/coverage-batch-b4 to test/coverage-campaign August 25, 2026 03:09
@roncodes
roncodes merged commit bf63b82 into test/coverage-campaign Aug 25, 2026
@roncodes
roncodes deleted the test/coverage-batch-b5 branch August 25, 2026 03:10
roncodes added a commit that referenced this pull request Aug 25, 2026
The comments indexed findings under an earlier scheme running to #160, which
this file restarted at #1. That numbering still appears in source comments —
full-calendar-test.js cites "DEFECTS.md #94 for Leaflet" — and resolved to
nothing once the comments went.

Appendix A maps the old numbering to what actually happened. I verified each
against current source rather than copying the claims across, and every finding
in that set has since been resolved: filter/multi-option's task-called-as-a-
function, overlay.resize clamping the wrong dimension, custom-field/form (the
file is gone), set-height's "px", leaflet's never-set `initialized`,
transition-to's self-satisfying assert, resource-context-panel's validate order,
the money arm, and the whole dead-member list. #148 in particular — the three
query-builder validate* actions nothing performed, so a panel kept sorting by
deselected columns — is wired to {{did-update}} in all three panels now.

Appendix B keeps the seven categories the remaining gaps fall into, including
the distinction that cost the most time: a default on a plain function is real
reachable surface, a default on a framework-invoked signature is dead, and
istanbul's branch map cannot tell them apart. Category 7 is annotated with what
has happened since — most of the "harness question" files turned out to be
drivable, so it is now flagged as unverified-until-tried.

Appendix C keeps the habits, led by the one that keeps proving itself: a green
test is not evidence that the branch you aimed at ran.

Nothing is imported as an open item. The tracker's open list is unchanged at
#1-#17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant