mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:18:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -62,11 +62,15 @@ vi.mock("@mariozechner/pi-ai", async () => {
|
||||
return {
|
||||
...actual,
|
||||
complete: async (model: { api: string; provider: string; id: string }) => {
|
||||
if (model.id === "mock-error") return buildAssistantErrorMessage(model);
|
||||
if (model.id === "mock-error") {
|
||||
return buildAssistantErrorMessage(model);
|
||||
}
|
||||
return buildAssistantMessage(model);
|
||||
},
|
||||
completeSimple: async (model: { api: string; provider: string; id: string }) => {
|
||||
if (model.id === "mock-error") return buildAssistantErrorMessage(model);
|
||||
if (model.id === "mock-error") {
|
||||
return buildAssistantErrorMessage(model);
|
||||
}
|
||||
return buildAssistantMessage(model);
|
||||
},
|
||||
streamSimple: (model: { api: string; provider: string; id: string }) => {
|
||||
@@ -104,7 +108,9 @@ beforeAll(async () => {
|
||||
}, 20_000);
|
||||
|
||||
afterAll(async () => {
|
||||
if (!tempRoot) return;
|
||||
if (!tempRoot) {
|
||||
return;
|
||||
}
|
||||
await fs.rm(tempRoot, { recursive: true, force: true });
|
||||
tempRoot = undefined;
|
||||
});
|
||||
@@ -142,7 +148,9 @@ const testSessionKey = "agent:test:embedded";
|
||||
const immediateEnqueue = async <T>(task: () => Promise<T>) => task();
|
||||
|
||||
const textFromContent = (content: unknown) => {
|
||||
if (typeof content === "string") return content;
|
||||
if (typeof content === "string") {
|
||||
return content;
|
||||
}
|
||||
if (Array.isArray(content) && content[0]?.type === "text") {
|
||||
return (content[0] as { text?: string }).text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user