Repository navigation
test: cover the CaseStudies render contract and its filter behaviour - #466
Merged
Merged
Conversation
src/components/CaseStudies/index.js was never imported by any test, so it did not appear in the node --test coverage report at all. Its filter predicate and facet option lists are module-private, so the only way to reach them is to render the component. Add tests/case-studies.test.mjs, which imports the component through the existing tests/helpers-jsx.mjs tooling and drives useState/useMemo through React's dispatcher slot. It asserts the table rows against the real data/case-studies.json, the deduplicated and sorted select options, the case-insensitive and whitespace-trimming query filter, filter intersection, the empty state, the Clear filters gate and reset, the labelling and aria-live contract, and rel=noreferrer on every outbound link including the sync-status credit. Coverage of the component goes from absent to 100% lines / 100% functions / 94.59% branches. No production code changes. Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
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 Hive will automatically remove the |
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.
Test Improvement
Adds
tests/case-studies.test.mjs(new file; no production code touched).src/components/CaseStudies/index.jswas never imported by any test — it did not appear in thenode --test --experimental-test-coveragetable at all. Its filter predicate (filterCaseStudies) and facet option builder (useCaseStudyFilterOptions) are module-private, so rendering the component is the only way to reach them.The test imports the component through the existing
tests/helpers-jsx.mjstooling andtests/tools/react-element-tree.mjs, and drivesuseState/useMemothrough React's per-render dispatcher slot with a small local driver kept inside the test file. It deliberately does not touchtests/tools/react-hook-driver.mjs, which #435 is extending.16 tests assert:
data/case-studies.json, and the matching results-bar textstudy.urlwithtarget="_blank"+rel="noreferrer", and its cells joinprojects/industries/countriesscope="row"on every row header and the four column headings<select>offers exactly the deduplicated, sorted facet values in the data, behind an empty-valued placeholder<label for=...>bound to its idSyncStatusrenders thedata.sourceUrlcredit withrel="noreferrer"and the formattedgeneratedAtdatearia-label="CNCF case studies"on the region andaria-live="polite"on the countCoverage
src/components/CaseStudies/index.js: absent from the report → 100.00% lines, 100.00% functions, 94.59% branches.Full suite on this branch:
npm run test:unit— 610 pass, 0 fail (594 onmainat0fd5f8b), Node v26.8.1.npx prettier --check tests/case-studies.test.mjsis clean.Files claimed by this PR
tests/case-studies.test.mjsonly. Disjoint from every open hold-gated PR: #435 (tests/architecture-filters-ui.test.mjs,tests/tools/react-hook-driver.mjs), #443 (tests/metrics-dashboard.test.mjs), #453 (tests/awards-timeline.test.mjs), #458 (tests/radar-reports.test.mjs), #460 (tests/footer.test.mjs,tests/jsx-hooks.test.mjs,tests/tools/jsx-hooks.mjs), #446, #437, #455, #225.Related Issue
Closes #465
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5