@@ -19,10 +19,11 @@ import (
1919func goodSite (t * testing.T , prefix string ) string {
2020 t .Helper ()
2121 root := t .TempDir ()
22- writeFile (t , filepath .Join (root , "development" , "merge-queue" , "index.html" ),
23- `<a href="` + prefix + `/development/pr-fixup-workflow/">pr fixup</a>` )
24- writeFile (t , filepath .Join (root , "development" , "architecture-audit" , "index.html" ),
25- `<a href="` + prefix + `/development/architecture/">arch</a>` )
22+ // A .md content link rendered to a clean doc permalink
23+ // (reference/index.md links its sibling cli.md, served at
24+ // /reference/cli/) — satisfies the sibling-.md probe.
25+ writeFile (t , filepath .Join (root , "reference" , "index.html" ),
26+ `<a href="` + prefix + `/reference/cli/">cli</a>` )
2627 writeFile (t , filepath .Join (root , "reference" , "schema-types" , "index.html" ),
2728 `<a href="` + prefix + `/rules/mds020-required-structure/">rule</a>` )
2829 writeFile (t , filepath .Join (root , "rules" , "mds001" , "index.html" ),
@@ -48,37 +49,27 @@ func TestVerifyWebsiteLinks_SubpathDeployPasses(t *testing.T) {
4849// match `href=value` as well as `href="value"`.
4950func TestVerifyWebsiteLinks_AcceptsUnquotedHref (t * testing.T ) {
5051 root := t .TempDir ()
51- writeFile (t , filepath .Join (root , "development" , "merge-queue" , "index.html" ),
52- `<a href=/development/pr-fixup-workflow/>pr fixup</a>` )
53- writeFile (t , filepath .Join (root , "development" , "architecture-audit" , "index.html" ),
54- `<a href=/development/architecture/>arch</a>` )
52+ writeFile (t , filepath .Join (root , "reference" , "index.html" ),
53+ `<a href=/reference/cli/>cli</a>` )
5554 writeFile (t , filepath .Join (root , "reference" , "schema-types" , "index.html" ),
5655 `<a href=/rules/mds020-required-structure/>rule</a>` )
5756 writeFile (t , filepath .Join (root , "rules" , "mds001" , "index.html" ),
5857 `<a href=/rules/mds021/>sibling</a>` )
5958 require .NoError (t , VerifyWebsiteLinks (root , "" ))
6059}
6160
61+ // TestVerifyWebsiteLinks_FailsOnMissingSiblingMD removes the only
62+ // clean doc permalink so the recursive sibling-.md probe finds no
63+ // match anywhere in the rendered tree.
6264func TestVerifyWebsiteLinks_FailsOnMissingSiblingMD (t * testing.T ) {
6365 root := goodSite (t , "" )
64- writeFile (t , filepath .Join (root , "development" , "merge-queue " , "index.html" ),
65- `<a href="pr-fixup-workflow .md">stale .md ref</a>` )
66+ writeFile (t , filepath .Join (root , "reference " , "index.html" ),
67+ `<a href="cli .md">stale .md ref</a>` )
6668 err := VerifyWebsiteLinks (root , "" )
6769 require .Error (t , err )
6870 assert .Contains (t , err .Error (), "sibling .md" )
6971}
7072
71- func TestVerifyWebsiteLinks_FailsOnIndexMDMisresolved (t * testing.T ) {
72- root := goodSite (t , "" )
73- // Simulate the bug PR #309 fixed: relative target stayed
74- // relative, browser resolves below the leaf page.
75- writeFile (t , filepath .Join (root , "development" , "architecture-audit" , "index.html" ),
76- `<a href="architecture/">stale relative</a>` )
77- err := VerifyWebsiteLinks (root , "" )
78- require .Error (t , err )
79- assert .Contains (t , err .Error (), "index.md drop" )
80- }
81-
8273func TestVerifyWebsiteLinks_FailsOnLeakedREADMEHref (t * testing.T ) {
8374 root := goodSite (t , "" )
8475 writeFile (t , filepath .Join (root , "rules" , "mds999" , "index.html" ),
@@ -131,10 +122,8 @@ func TestVerifyWebsiteLinks_FailsOnMissingSiteAbsolute(t *testing.T) {
131122 // Build a tree that has every required href except the
132123 // site-absolute /rules/mdsxxx/ form.
133124 root := t .TempDir ()
134- writeFile (t , filepath .Join (root , "development" , "merge-queue" , "index.html" ),
135- `<a href="/mdsmith/development/pr-fixup-workflow/">x</a>` )
136- writeFile (t , filepath .Join (root , "development" , "architecture-audit" , "index.html" ),
137- `<a href="/mdsmith/development/architecture/">x</a>` )
125+ writeFile (t , filepath .Join (root , "reference" , "index.html" ),
126+ `<a href="/mdsmith/reference/cli/">x</a>` )
138127 // No MDS-rule href under any subpath.
139128 err := VerifyWebsiteLinks (root , "https://example.com/mdsmith/" )
140129 require .Error (t , err )
@@ -180,13 +169,11 @@ func TestVerifyWebsiteLinks_InvalidBaseURLWraps(t *testing.T) {
180169// calls the callback with a stat error.
181170func TestVerifyWebsiteLinks_MissingRecursiveRootWraps (t * testing.T ) {
182171 root := t .TempDir ()
183- // Materialize only the non-recursive probe targets plus a
172+ // Materialize only the non-recursive probe target plus a
184173 // page carrying the site-absolute rule href, so we reach
185174 // the recursive `no README.md leak` probe.
186- writeFile (t , filepath .Join (root , "development" , "merge-queue" , "index.html" ),
187- `<a href="/development/pr-fixup-workflow/">x</a>` )
188- writeFile (t , filepath .Join (root , "development" , "architecture-audit" , "index.html" ),
189- `<a href="/development/architecture/">x</a>` )
175+ writeFile (t , filepath .Join (root , "reference" , "index.html" ),
176+ `<a href="/reference/cli/">x</a>` )
190177 writeFile (t , filepath .Join (root , "reference" , "schema-types" , "index.html" ),
191178 `<a href="/rules/mds020-required-structure/">x</a>` )
192179 // rules/ is absent.
0 commit comments