mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 19:57:27 +00:00
fix: add gateway session reset routing coverage (#44773) (thanks @Lanfei)
This commit is contained in:
@@ -266,6 +266,7 @@ describe("gateway server sessions", () => {
|
||||
lastChannel: "whatsapp",
|
||||
lastTo: "+1555",
|
||||
lastAccountId: "work",
|
||||
lastThreadId: "1737500000.123456",
|
||||
},
|
||||
"discord:group:dev": {
|
||||
sessionId: "sess-group",
|
||||
@@ -336,6 +337,7 @@ describe("gateway server sessions", () => {
|
||||
channel: "whatsapp",
|
||||
to: "+1555",
|
||||
accountId: "work",
|
||||
threadId: "1737500000.123456",
|
||||
});
|
||||
|
||||
const active = await rpcReq<{
|
||||
@@ -545,13 +547,27 @@ describe("gateway server sessions", () => {
|
||||
const reset = await rpcReq<{
|
||||
ok: true;
|
||||
key: string;
|
||||
entry: { sessionId: string; modelProvider?: string; model?: string };
|
||||
entry: {
|
||||
sessionId: string;
|
||||
modelProvider?: string;
|
||||
model?: string;
|
||||
lastAccountId?: string;
|
||||
lastThreadId?: string | number;
|
||||
};
|
||||
}>(ws, "sessions.reset", { key: "agent:main:main" });
|
||||
expect(reset.ok).toBe(true);
|
||||
expect(reset.payload?.key).toBe("agent:main:main");
|
||||
expect(reset.payload?.entry.sessionId).not.toBe("sess-main");
|
||||
expect(reset.payload?.entry.modelProvider).toBe("openai");
|
||||
expect(reset.payload?.entry.model).toBe("gpt-test-a");
|
||||
expect(reset.payload?.entry.lastAccountId).toBe("work");
|
||||
expect(reset.payload?.entry.lastThreadId).toBe("1737500000.123456");
|
||||
const storeAfterReset = JSON.parse(await fs.readFile(storePath, "utf-8")) as Record<
|
||||
string,
|
||||
{ lastAccountId?: string; lastThreadId?: string | number }
|
||||
>;
|
||||
expect(storeAfterReset["agent:main:main"]?.lastAccountId).toBe("work");
|
||||
expect(storeAfterReset["agent:main:main"]?.lastThreadId).toBe("1737500000.123456");
|
||||
const filesAfterReset = await fs.readdir(dir);
|
||||
expect(filesAfterReset.some((f) => f.startsWith("sess-main.jsonl.reset."))).toBe(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user