@@ -2,6 +2,11 @@ import { render, screen, within } from "@testing-library/react";
22import { describe , expect , it } from "vitest" ;
33
44import { CommandTable } from "@/components/site/command-table" ;
5+ import {
6+ ACTION_COMMAND_ENTRIES ,
7+ MAINTAINER_COMMAND_ENTRIES ,
8+ PUBLIC_COMMAND_ENTRIES ,
9+ } from "@/lib/command-reference" ;
510
611// #6986: pinned after migrating the hand-rolled <table> markup onto the shared Table primitive --
712// confirms the real table structure, columns, and default-role lookup still render correctly.
@@ -43,4 +48,24 @@ describe("CommandTable", () => {
4348 render ( < CommandTable title = "Commands reference" entries = { [ ] } /> ) ;
4449 expect ( screen . getByRole ( "heading" , { name : "Commands reference" } ) ) . toBeTruthy ( ) ;
4550 } ) ;
51+
52+ it ( "has a DEFAULT_ROLE_SUMMARY entry for every generated command id, never the generic fallback (#7096)" , ( ) => {
53+ // Drift guard: a new command added to any of the three src/github/commands.ts catalogs without a matching
54+ // DEFAULT_ROLE_SUMMARY entry must fail here rather than silently render "see policy" on the live docs page.
55+ const allEntries = [
56+ ...PUBLIC_COMMAND_ENTRIES ,
57+ ...MAINTAINER_COMMAND_ENTRIES ,
58+ ...ACTION_COMMAND_ENTRIES ,
59+ ] ;
60+ expect ( allEntries . length ) . toBeGreaterThan ( 0 ) ;
61+ const { container } = render ( < CommandTable title = "All commands" entries = { allEntries } /> ) ;
62+ const missing = allEntries
63+ . filter ( ( entry ) => within ( container ) . queryByText ( `@loopover ${ entry . id } ` ) )
64+ . filter ( ( entry ) => {
65+ const row = within ( container ) . getByText ( `@loopover ${ entry . id } ` ) . closest ( "tr" ) ;
66+ return row ?. textContent ?. includes ( "see policy" ) ;
67+ } )
68+ . map ( ( entry ) => entry . id ) ;
69+ expect ( missing ) . toEqual ( [ ] ) ;
70+ } ) ;
4671} ) ;
0 commit comments