test: cover session adapter edge cases

This commit is contained in:
Affaan Mustafa
2026-04-29 18:21:31 -04:00
parent 33edfd3bb3
commit aaaf52fb1e
2 changed files with 393 additions and 12 deletions

View File

@@ -19,7 +19,6 @@ const fs = require('fs');
const path = require('path');
const repoRoot = path.resolve(__dirname, '..');
const repoRootWithSep = `${repoRoot}${path.sep}`;
const packageJsonPath = path.join(repoRoot, 'package.json');
const packageLockPath = path.join(repoRoot, 'package-lock.json');
const rootAgentsPath = path.join(repoRoot, 'AGENTS.md');
@@ -70,16 +69,6 @@ function loadJsonObject(filePath, label) {
return parsed;
}
function assertSafeRepoRelativePath(relativePath, label) {
const normalized = path.posix.normalize(relativePath.replace(/\\/g, '/'));
assert.ok(!path.isAbsolute(relativePath), `${label} must not be absolute: ${relativePath}`);
assert.ok(
!normalized.startsWith('../') && !normalized.includes('/../'),
`${label} must not traverse directories: ${relativePath}`,
);
}
function collectMarkdownFiles(rootPath) {
if (!fs.existsSync(rootPath)) {
return [];