chore(hardening): add debt inventory and async io kickoff

This commit is contained in:
Tam Nhu Tran committed 2026-02-12 12:57:46 +07:00
1 parent e68ae5b166
commit cefb564948
8 files changed
+875 -3

No files matched your search

+14 -1
View File
@@ -2,7 +2,7 @@
* Unit tests for JSONL Parser
*/
import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
import { describe, expect, test, beforeEach, afterEach, spyOn } from 'bun:test';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
@@ -254,6 +254,19 @@ describe('parseProjectDirectory', () => {
const entries = await parseProjectDirectory('/nonexistent/dir');
expect(entries.length).toBe(0);
});
test('returns empty array when directory read fails', async () => {
const existsSyncSpy = spyOn(fs, 'existsSync').mockReturnValue(true);
const readdirSpy = spyOn(fs.promises, 'readdir').mockRejectedValue(new Error('EACCES'));
try {
const entries = await parseProjectDirectory('/protected/dir');
expect(entries).toEqual([]);
} finally {
existsSyncSpy.mockRestore();
readdirSpy.mockRestore();
}
});
});
describe('findProjectDirectories', () => {