mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 09:02:15 +00:00
Gateway: refine BOOTSTRAP post-onboarding filtering
This commit is contained in:
@@ -119,6 +119,12 @@ function createEnoentError() {
|
||||
return err;
|
||||
}
|
||||
|
||||
function createErrnoError(code: string) {
|
||||
const err = new Error(code) as NodeJS.ErrnoException;
|
||||
err.code = code;
|
||||
return err;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mocks.fsReadFile.mockImplementation(async () => {
|
||||
throw createEnoentError();
|
||||
@@ -423,4 +429,20 @@ describe("agents.files.list", () => {
|
||||
const files = (result as { files: Array<{ name: string }> }).files;
|
||||
expect(files.some((file) => file.name === "BOOTSTRAP.md")).toBe(false);
|
||||
});
|
||||
|
||||
it("falls back to showing BOOTSTRAP.md when workspace state cannot be read", async () => {
|
||||
mocks.fsReadFile.mockImplementation(async (filePath: string | URL | number) => {
|
||||
if (String(filePath).endsWith("workspace-state.json")) {
|
||||
throw createErrnoError("EACCES");
|
||||
}
|
||||
throw createEnoentError();
|
||||
});
|
||||
|
||||
const { respond, promise } = makeCall("agents.files.list", { agentId: "main" });
|
||||
await promise;
|
||||
|
||||
const [, result] = respond.mock.calls[0] ?? [];
|
||||
const files = (result as { files: Array<{ name: string }> }).files;
|
||||
expect(files.some((file) => file.name === "BOOTSTRAP.md")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user