Repository navigation
test(docs): pin crux project detection and raw Meta stripping in the slug layout - #498
Conversation
…slug layout getProjectFromSlug gained a crux arm in #490 but the SlugLayout table only pinned the other six projects, so dropping the arm would silently serve crux pages with the hive sidebar. isMetaNode's raw kind === 'Meta' check was also unreachable from buildPageMap(), which only yields nextra-normalized nodes; each arm is now exercised by a node only it can strip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
❌ Deploy Preview for hivecommons-docs failed. Why did it fail? →
|
There was a problem hiding this comment.
Looks correct to me; both mutation claims reproduce.
Ran npx vitest run src/__tests__/docs-slug-page.params-metadata.test.tsx at 4e18f3c on top of main d2742ce: 10/10 pass. Then mutated src/app/docs/[...slug]/layout.tsx:
- commenting out
if (item.kind === 'Meta') return true(layout.tsx:40) → the new raw-Meta test fails; the nested{ data: { nested } }node is still stripped by the normalized arm at:42, so the test isolates thekindarm as described. - commenting out
if (slug[0] === 'crux') return 'crux'(layout.tsx:18) →expected 'hive' to be 'crux'from the extended project table.
The ../app/docs/page-map mock resolves to the same module layout.tsx:2 imports via '../page-map', and the mock is unmocked in finally, matching the pattern of the existing SidebarContainer mock at :222. Test-only change, no fragment needed.
The red netlify/* checks also failed on #497 (merged), so they look environmental rather than caused by this diff.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Test Improvement
Two branches in
src/app/docs/[...slug]/layout.tsxwere unpinned:getProjectFromSluggained acruxarm in docs: add Crux section #490, but theSlugLayoutproject table indocs-slug-page.params-metadata.test.tsxonly listed the other six projects. Removing the arm leaves every test green while crux pages render with the hive sidebar — verified by mutation (expected 'hive' to be 'crux'once the row is added).isMetaNode's rawkind === 'Meta'check was unreachable frombuildPageMap(), which only yields nextra-normalized Meta nodes. The new case hand-builds a page map whose raw Meta nodes carry aname, so only thekindarm can strip them; the nested normalized node keeps the other arm honest. Deleting either arm now fails the test.Coverage:
layout.tsxbranches 88.9% → 96.3%; total 99.31 / 97.57 / 100 / 99.8 vs floors 98 / 96 / 99 / 99 (1313 tests). Test-only change, so nochangelog.dfragment perchangelog.d/README.md.Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88