mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-18 12:08:52 +00:00
test: check skill scanner permission errors
This commit is contained in:
@@ -626,7 +626,13 @@ describe("scanDirectoryWithSummary", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await expect(scanDirectoryWithSummary(root)).rejects.toMatchObject({ code: "EACCES" });
|
||||
let thrown: unknown;
|
||||
try {
|
||||
await scanDirectoryWithSummary(root);
|
||||
} catch (error) {
|
||||
thrown = error;
|
||||
}
|
||||
expect((thrown as NodeJS.ErrnoException | undefined)?.code).toBe("EACCES");
|
||||
} finally {
|
||||
spy.mockRestore();
|
||||
}
|
||||
@@ -660,7 +666,13 @@ describe("scanDirectoryWithSummary", () => {
|
||||
const spy = mockStatPermissionDeniedFor(filePath);
|
||||
|
||||
try {
|
||||
await expect(scanDirectory(root)).rejects.toMatchObject({ code: "EACCES" });
|
||||
let thrown: unknown;
|
||||
try {
|
||||
await scanDirectory(root);
|
||||
} catch (error) {
|
||||
thrown = error;
|
||||
}
|
||||
expect((thrown as NodeJS.ErrnoException | undefined)?.code).toBe("EACCES");
|
||||
} finally {
|
||||
spy.mockRestore();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user