From 9c4dde977da744adfc22694a5f9c6f282eefd62f Mon Sep 17 00:00:00 2001 From: Zied Jlassi <6190550+zied-jlassi@users.noreply.github.com> Date: Sat, 20 Jun 2026 15:20:10 +0200 Subject: [PATCH] test(validate-refs): document test helpers with JSDoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added JSDoc to the test/assert/leakCount helpers so the new test file documents its own helpers. No behaviour change — 6/6 still pass. --- test/test-abs-path-leak.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/test-abs-path-leak.js b/test/test-abs-path-leak.js index 9301f2160..2c837677f 100644 --- a/test/test-abs-path-leak.js +++ b/test/test-abs-path-leak.js @@ -22,6 +22,11 @@ let totalTests = 0; let passedTests = 0; const failures = []; +/** + * Run a single named test case, recording the result and printing a status line. + * @param {string} name - Human-readable test description. + * @param {Function} fn - Test body; throw to signal failure. + */ function test(name, fn) { totalTests++; try { @@ -34,11 +39,20 @@ function test(name, fn) { } } +/** + * Throw an Error with `message` when `condition` is falsy. + * @param {boolean} condition - Expression that must hold. + * @param {string} message - Failure message. + */ function assert(condition, message) { if (!condition) throw new Error(message); } -// Number of leak lines detected in a content string (filePath is only used for labelling). +/** + * Count the leak lines detected in a content string. + * @param {string} content - File content to scan (filePath is only used for labelling). + * @returns {number} Number of lines flagged as absolute-path leaks. + */ function leakCount(content) { return checkAbsolutePathLeaks('fixture.md', content).length; }