test: cover the data/awards.json render contract (tests/awards-data.test.mjs) - #360
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…est.mjs) scripts/validate-awards.mjs checks truthiness, an ^https:// prefix and a year floor. src/components/AwardsTimeline/index.js is stricter, so an awards file that passes npm run validate:awards can still render a wrong or misleading /awards page. Nine single-field mutations were applied to data/awards.json one at a time; eight pass the validator and are caught by these tests. The sharpest is verifiedAgainst: AwardsTimeline hard-codes the visible link text 'contribute.cncf.io/community/awards', so the href and its label can drift apart and the page misattributes its own audit source. There is no JSX transform under node --test, so the component cannot be imported; the contract is asserted against the component source plus the real data. Test-only change; no production code is touched. Closes #359 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> 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 |
2 tasks
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 one new test-only file,
tests/awards-data.test.mjs(11 tests), assertingthe real
data/awards.jsonagainst the render contract thatsrc/components/AwardsTimeline/index.jsdepends on.Files claimed by this PR:
tests/awards-data.test.mjs(new). Nothing else —no production code, no workflow, no
package.json, no lockfile, no dependency.It uses only
node:test,node:assert/strict,node:fs,node:pathandnode:url.The gap
scripts/validate-awards.mjsis tolerant exactly whereAwardsTimelineis not,so an awards file that passes
npm run validate:awardscan still render a wrongor misleading
/awardspage:https://URL forverifiedAgainst, but thecomponent hard-codes the visible link text
contribute.cncf.io/community/awards— href and label can drift apart and thepage then misattributes its own audit source
Date.parse(verifiedAt); a future date passes and thebanner claims an audit that has not happened
!entry[field], socitation: 5andevent: " "passand render as
5and a blank line/^https:\/\//accepts the bare stringhttps://, whichnew URL()rejectsand no browser can resolve
${slug}-${index}, so aduplicated winner renders twice silently
awardis a machine slug andawardLabelits display string; two labels forone slug read as two different awards
Verification
Local clone of
cncf/endusersat00b44df, node v26.8.2, 2026-09-20.node --test: 66 pass, 0 fail (55 before; the 11 new tests are all thatchanged).
npx prettier --check tests/awards-data.test.mjs: clean.npm run validate:awardson restored data: passes.Mutation check. Nine single-field mutations applied to
data/awards.json,one at a time, each restored afterwards. Eight pass the validator and are caught
here:
validate:awardstests/awards-data.test.mjsverifiedAgainstrepointed to another hostverifiedAtset to a future datecitationset to a numbereventset to" "slugset toAcme_CorpannouncementUrlset tohttps://awardLabels for oneawardslugyear(1999)data/awards.jsonis byte-identical tomainafter the run (git diffclean).Disjointness
No open PR names
AwardsTimelineor readsdata/awards.jsontop-level fields.#253 (
tests/members-data.test.mjs) touchesawards.jsononly formembers.json↔ award slug parity; it asserts nothing aboutverifiedAt,verifiedAgainst, ordering, duplicates, URL resolvability or label consistency,and reads no component. #329 claims award logo path resolution, which this
PR deliberately leaves alone. #287 is the same species of contract for
metrics.json↔MetricsDashboard; #260 covers catalog ↔ records ↔ docs; #229covers
filterArchitectures; #268 coversuseFocusTrap.There is no JSX transform under
node --test(#228), so the component cannot beimported; the two cross-file assertions read the component source and are
written to fail loudly — rather than vacuously pass — if the source stops
matching.
Related Issue
Closes #359
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5