mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:50:42 +00:00
test: tighten session proxy assertions
This commit is contained in:
@@ -464,6 +464,7 @@ describe("proxy cli runtime", () => {
|
||||
const { runDebugProxyRunCommand } = await import("./proxy-cli.runtime.js");
|
||||
const { getDebugProxyCaptureStore } = await import("../proxy-capture/store.sqlite.js");
|
||||
|
||||
const beforeRun = Date.now();
|
||||
await expect(
|
||||
runDebugProxyRunCommand({
|
||||
commandArgs: ["does-not-exist"],
|
||||
@@ -478,6 +479,6 @@ describe("proxy cli runtime", () => {
|
||||
);
|
||||
const [session] = store.listSessions(5);
|
||||
expect(session?.mode).toBe("proxy-run");
|
||||
expect(session?.endedAt).toEqual(expect.any(Number));
|
||||
expect(session?.endedAt).toBeGreaterThanOrEqual(beforeRun);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -207,13 +207,13 @@ describe("agentCommand runtime config", () => {
|
||||
const resolved = resolveSession({ cfg, to: "+1555" });
|
||||
|
||||
expect(resolved.storePath).toBe(store);
|
||||
expect(resolved.sessionKey).toEqual(expect.any(String));
|
||||
expect(resolved.sessionKey).toBeTypeOf("string");
|
||||
const sessionKey = resolved.sessionKey;
|
||||
if (!sessionKey) {
|
||||
throw new Error("expected session key");
|
||||
}
|
||||
expect(sessionKey.length).toBeGreaterThan(0);
|
||||
expect(resolved.sessionId).toEqual(expect.any(String));
|
||||
expect(resolved.sessionId).toBeTypeOf("string");
|
||||
expect(resolved.sessionId.length).toBeGreaterThan(0);
|
||||
expect(resolved.isNewSession).toBe(true);
|
||||
});
|
||||
|
||||
@@ -141,8 +141,8 @@ describe("runCronIsolatedAgentTurn session identity", () => {
|
||||
const first = (await runPingTurn()).res;
|
||||
const second = (await runPingTurn()).res;
|
||||
|
||||
expect(first.sessionId).toEqual(expect.any(String));
|
||||
expect(second.sessionId).toEqual(expect.any(String));
|
||||
expect(first.sessionId).toBeTypeOf("string");
|
||||
expect(second.sessionId).toBeTypeOf("string");
|
||||
expect(second.sessionId).not.toBe(first.sessionId);
|
||||
expect(first.sessionKey).toMatch(/^agent:main:cron:job-1:run:/);
|
||||
expect(second.sessionKey).toMatch(/^agent:main:cron:job-1:run:/);
|
||||
|
||||
Reference in New Issue
Block a user