Context
scripts/__tests__/ has unit tests for docs-lint.mjs (docs-lint.test.mjs) and docs-typecheck.mjs (docs-typecheck.test.mjs), but the third script in the docs-lint pipeline — scripts/docs-link-check.mjs — has zero unit coverage.
This came up during PR #116 review: a regression where 43 internal links silently rotted was not caught by the existing link-check. Even after we add a lint rule (#new-issue-from-PR-116), the rule's own behaviour should be pinned by tests.
Proposal
Create scripts/__tests__/docs-link-check.test.mjs modelled after the existing docs-lint.test.mjs fixture pattern (scripts/tests/docs-lint.test.mjs:132-177).
Suggested test cases:
- Internal
/docs/... paths
- Resolves to a real page → passes.
- Resolves to a missing page → reports as broken.
- Resolves to a directory with
0.index.md → passes.
- Heading fragments (
#some-section)
- Matches a real heading → passes.
- Matches a slugged heading with
-1/-2 suffix due to collision → passes.
- References a missing heading → reports as broken.
- Frontmatter
links: - to: /docs/...
- Real internal target → passes.
- Missing internal target → reports as broken.
- External URLs
https://example.com/... ignored entirely.
https://github.com/bitrix24/b24jssdk/blob/main/<path> either ignored (current behaviour) or checked (once #new-issue lands).
Acceptance criteria
Related
Context
scripts/__tests__/has unit tests fordocs-lint.mjs(docs-lint.test.mjs) anddocs-typecheck.mjs(docs-typecheck.test.mjs), but the third script in the docs-lint pipeline —scripts/docs-link-check.mjs— has zero unit coverage.This came up during PR #116 review: a regression where 43 internal links silently rotted was not caught by the existing link-check. Even after we add a lint rule (#new-issue-from-PR-116), the rule's own behaviour should be pinned by tests.
Proposal
Create
scripts/__tests__/docs-link-check.test.mjsmodelled after the existingdocs-lint.test.mjsfixture pattern (scripts/tests/docs-lint.test.mjs:132-177).Suggested test cases:
/docs/...paths0.index.md→ passes.#some-section)-1/-2suffix due to collision → passes.links: - to: /docs/...https://example.com/...ignored entirely.https://github.com/bitrix24/b24jssdk/blob/main/<path>either ignored (current behaviour) or checked (once #new-issue lands).Acceptance criteria
scripts/__tests__/docs-link-check.test.mjsexists with at least the cases above.pnpm run docs:lint:testruns them (the script already globsscripts/__tests__/**/*.test.mjs).mainand would catch a future regression where ato:field rots.Related