Skip to content

test(react-harness): cover the six uncovered regions in the hook driver - #706

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-react-hook-driver-regions
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-react-hook-driver-regions

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

tests/tools/react-hook-driver.mjs is the dispatcher every component suite
reads its subject through, and six of its sub-line regions were unexercised.
This adds six tests to tests/react-harness.test.mjs — the file that already
exists to pin harness branches no component suite happens to reach — one per
uncovered region:

  • a lazy useState initialiser is called once and its value is stored
  • a functional updater is applied to the current value
  • setting state to the value it already holds does not re-run the hook body
  • an effect with unchanged dependencies is not run again
  • an omitted dependency array re-runs both the memo and the effect
  • unmounting twice runs each cleanup only once

Files touched: tests/react-harness.test.mjs only. No production code and no
other test file changes, so this is disjoint from the open test PRs (#678,
#680, #686, #688, #693, #702), which claim scripts/ fixtures and
tests/{import-architectures,svg-active-content,fetch-community-people,validate-*,collect-*,coverage-report-collect}.

Region coverage for tests/tools/react-hook-driver.mjs: 87.23% -> 100.00%
(TZ=UTC node tests/tools/coverage-report.mjs). Line coverage was already
100%, so this is a pure region gain and no existing assertion changes.

Related Issue

Closes #705


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

tests/tools/react-hook-driver.mjs sits under every component suite, yet six
of its sub-line regions were unexercised: the lazy useState initialiser, the
functional updater, the Object.is bail-out, the undefined-deps arm of
sameDeps, the unchanged-deps effect skip, and the repeat-unmount guard. A
regression in any of them surfaces as an unexplained component failure, or as
a suite that keeps passing while asserting nothing.

This adds six tests to tests/react-harness.test.mjs, the file that already
exists to pin harness branches no component suite reaches. Region coverage
for tests/tools/react-hook-driver.mjs goes from 87.23% to 100%.

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@hivecommons-hive hivecommons-hive Bot added quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI labels Sep 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] tests/tools/react-hook-driver.mjs has six uncovered sub-line regions

0 participants