test: tighten session proxy assertions

This commit is contained in:
Peter Steinberger
2026-05-08 14:25:43 +01:00
parent fa15090ead
commit 067ceb38b7
3 changed files with 6 additions and 5 deletions

View File

@@ -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);
});
});

View File

@@ -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);
});

View File

@@ -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:/);