You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests: cover exports, check-links, sync-counts, new-entry and the client search #67
Why it matters
The checks and library modules are well tested (site/checks.test.mjs, site/lib/lib.test.mjs), but several scripts that rewrite the repo or publish data have no tests. The bugs filed alongside this issue (feed author, llms regex, CSV cells, NUL loop) were all untested paths.
Gaps found
site/lib/exports.mjs: tests (lib.test.mjs:521-529) cover quoting, ordering and skipping deprecated entries only. There are no tests for the Atom required elements, the entry limit, empty input or formula-leading cells.
site/check-links.mjs: top-level code, untestable as written (see the hardening issue).
site/sync-counts.mjs: its regex $1${n} replacements rewrite README and category files, and nothing tests them.
site/new-entry.mjs: untested. It also throws a raw ENOENT when a category exists in config but catalog/<cat>/ doesn't (:47).
site/build.mjsmain() (loadEntries, licenseFamily, sitemapXml, robotsTxt) and site/validate.mjscheckRelativeLinks.
No adversarial tests for renderInline, absoluteLinks or llmsFullTxt (balanced parens, NUL, control characters).
Suggested approach
Stay dependency-free with node:test. Extract pure functions from the CLIs (sync-counts, new-entry, check-links) and from app.js (search scoring, URL parsing) into importable modules, and test those. Add node --test to npm test and CI.
Done when
Each module above has at least one test of its main behaviour and one edge case, and CI runs them.
Why it matters
The checks and library modules are well tested (
site/checks.test.mjs,site/lib/lib.test.mjs), but several scripts that rewrite the repo or publish data have no tests. The bugs filed alongside this issue (feed author, llms regex, CSV cells, NUL loop) were all untested paths.Gaps found
site/lib/exports.mjs: tests (lib.test.mjs:521-529) cover quoting, ordering and skipping deprecated entries only. There are no tests for the Atom required elements, the entrylimit, empty input or formula-leading cells.site/check-links.mjs: top-level code, untestable as written (see the hardening issue).site/sync-counts.mjs: its regex$1${n}replacements rewrite README and category files, and nothing tests them.site/new-entry.mjs: untested. It also throws a raw ENOENT when a category exists in config butcatalog/<cat>/doesn't (:47).site/build.mjsmain()(loadEntries,licenseFamily,sitemapXml,robotsTxt) andsite/validate.mjscheckRelativeLinks.site/public/app.jssearch andreadUrl,shortlist.js,not-found.jssuggestions) has no tests. Search ranking and word-boundary matching (ui: search matches inside words ("ui" matches "build", "art" matches "earth") #16, ui: search is slow per keystroke (1s+ on throttled CPU) #17) could regress without anyone noticing.renderInline,absoluteLinksorllmsFullTxt(balanced parens, NUL, control characters).Suggested approach
Stay dependency-free with
node:test. Extract pure functions from the CLIs (sync-counts,new-entry,check-links) and fromapp.js(search scoring, URL parsing) into importable modules, and test those. Addnode --testtonpm testand CI.Done when
Each module above has at least one test of its main behaviour and one edge case, and CI runs them.