Files
get-shit-done/tests/reachability-check.test.cjs
Tom Boucher 2703422be8 refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md (#1675)
* refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md

- Replace require('node:assert') with require('node:assert/strict') across
  all 73 test files to enforce strict equality (no type coercion)
- Replace try/finally cleanup blocks with t.after() hooks in core.test.cjs
  and hooks-opt-in.test.cjs per the test lifecycle standards
- Utility functions in codex-config and security-scan retain try/finally
  as that is appropriate for per-function resource guards, not lifecycle hooks

Closes #1674

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* perf(tests): add --test-concurrency=4 to test runner for parallel file execution

Node.js --test-concurrency controls how many test files run as parallel child
processes. Set to 4 by default, configurable via TEST_CONCURRENCY env var.
Fixes tests at a known level rather than inheriting os.availableParallelism()
which varies across CI environments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): allowlist verify.test.cjs in prompt-injection scanner

tests/verify.test.cjs uses <human>...</human> as GSD phase task-type
XML (meaning "a human should verify this step"), which matches the
scanner's fake-message-boundary pattern for LLM APIs. This is a
false positive — add it to the allowlist alongside the other test files
that legitimately contain injection-adjacent patterns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 14:29:03 -04:00

54 lines
2.4 KiB
JavaScript

const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
describe('gsd-planner reachability_check step', () => {
const plannerPath = path.join(__dirname, '..', 'agents', 'gsd-planner.md');
let content;
test('planner file exists', () => {
assert.ok(fs.existsSync(plannerPath));
content = fs.readFileSync(plannerPath, 'utf-8');
});
test('contains reachability_check step', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
assert.ok(content.includes('<step name="reachability_check">'), 'Missing reachability_check step');
});
test('reachability_check appears after derive_must_haves', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
const mustHavesIdx = content.indexOf('derive_must_haves');
const reachabilityIdx = content.indexOf('reachability_check');
assert.ok(mustHavesIdx > -1, 'derive_must_haves step not found');
assert.ok(reachabilityIdx > -1, 'reachability_check step not found');
assert.ok(reachabilityIdx > mustHavesIdx, 'reachability_check must come after derive_must_haves');
});
test('reachability_check appears before estimate_scope', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
const reachabilityIdx = content.indexOf('reachability_check');
const estimateIdx = content.indexOf('estimate_scope');
assert.ok(estimateIdx > -1, 'estimate_scope step not found');
assert.ok(reachabilityIdx < estimateIdx, 'reachability_check must come before estimate_scope');
});
test('reachability_check includes creation path check', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
assert.ok(content.includes('creation path') || content.includes('creation_path') || content.includes('reachable'),
'Missing creation path verification logic');
});
test('reachability_check includes UNREACHABLE marker', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
assert.ok(content.includes('UNREACHABLE'), 'Missing UNREACHABLE marker for failed checks');
});
test('file stays under 50000 char limit (CRLF-normalized)', () => {
content = content || fs.readFileSync(plannerPath, 'utf-8');
const normalized = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
assert.ok(normalized.length < 50000, `File is ${normalized.length} chars, over the 50000 limit`);
});
});