test: add Round 92 tests for object pattern, UNC path, and empty packageManager

- Test countInFile returns 0 for object pattern type (non-string non-RegExp)
- Test getSessionStats treats Windows UNC path as content (not file path)
- Test detectFromPackageJson returns null for empty string packageManager field

Total tests: 836
This commit is contained in:
Affaan Mustafa
2026-02-13 14:05:24 -08:00
parent 14dfe4d110
commit b9a38b2680
3 changed files with 46 additions and 0 deletions

View File

@@ -1461,6 +1461,19 @@ src/main.ts
assert.strictEqual(stats.totalItems, 0, 'Non-existent path should have 0 items');
})) passed++; else failed++;
// ── Round 92: getSessionStats with UNC path treated as content ──
console.log('\nRound 92: getSessionStats (Windows UNC path):');
if (test('getSessionStats treats UNC path as content (not recognized as file path)', () => {
// session-manager.js line 163-166: The path heuristic checks for Unix paths
// (starts with /) and Windows drive-letter paths (/^[A-Za-z]:[/\\]/). UNC paths
// (\\server\share\file.tmp) don't match either pattern, so the function treats
// the string as pre-read content rather than a file path to read.
const stats = sessionManager.getSessionStats('\\\\server\\share\\session.tmp');
assert.strictEqual(stats.lineCount, 1,
'UNC path should be treated as single-line content (not a recognized path)');
})) passed++; else failed++;
// Summary
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);