mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 10:18:14 +00:00
chore(hardening): add debt inventory and async io kickoff
This commit is contained in:
1 parent
e68ae5b166
commit
cefb564948
8 files changed
+875
-3
No files matched your search
@@ -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', () => {
|
||||
|
||||
Reference in new issue
Block a user