mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:28:38 +00:00
test(cron): cover webhook session rollover overrides
This commit is contained in:
@@ -106,6 +106,9 @@ describe("resolveCronSession", () => {
|
|||||||
sessionId: "old-session-id",
|
sessionId: "old-session-id",
|
||||||
updatedAt: Date.now() - 86400000, // 1 day ago
|
updatedAt: Date.now() - 86400000, // 1 day ago
|
||||||
systemSent: true,
|
systemSent: true,
|
||||||
|
modelOverride: "gpt-4.1-mini",
|
||||||
|
providerOverride: "openai",
|
||||||
|
sendPolicy: "allow",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
vi.mocked(evaluateSessionFreshness).mockReturnValue({ fresh: false });
|
vi.mocked(evaluateSessionFreshness).mockReturnValue({ fresh: false });
|
||||||
@@ -120,6 +123,9 @@ describe("resolveCronSession", () => {
|
|||||||
expect(result.sessionEntry.sessionId).not.toBe("old-session-id");
|
expect(result.sessionEntry.sessionId).not.toBe("old-session-id");
|
||||||
expect(result.isNewSession).toBe(true);
|
expect(result.isNewSession).toBe(true);
|
||||||
expect(result.systemSent).toBe(false);
|
expect(result.systemSent).toBe(false);
|
||||||
|
expect(result.sessionEntry.modelOverride).toBe("gpt-4.1-mini");
|
||||||
|
expect(result.sessionEntry.providerOverride).toBe("openai");
|
||||||
|
expect(result.sessionEntry.sendPolicy).toBe("allow");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("creates new sessionId when forceNew is true", () => {
|
it("creates new sessionId when forceNew is true", () => {
|
||||||
@@ -128,6 +134,8 @@ describe("resolveCronSession", () => {
|
|||||||
sessionId: "existing-session-id-456",
|
sessionId: "existing-session-id-456",
|
||||||
updatedAt: Date.now() - 1000,
|
updatedAt: Date.now() - 1000,
|
||||||
systemSent: true,
|
systemSent: true,
|
||||||
|
modelOverride: "sonnet-4",
|
||||||
|
providerOverride: "anthropic",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
vi.mocked(evaluateSessionFreshness).mockReturnValue({ fresh: true });
|
vi.mocked(evaluateSessionFreshness).mockReturnValue({ fresh: true });
|
||||||
@@ -143,6 +151,8 @@ describe("resolveCronSession", () => {
|
|||||||
expect(result.sessionEntry.sessionId).not.toBe("existing-session-id-456");
|
expect(result.sessionEntry.sessionId).not.toBe("existing-session-id-456");
|
||||||
expect(result.isNewSession).toBe(true);
|
expect(result.isNewSession).toBe(true);
|
||||||
expect(result.systemSent).toBe(false);
|
expect(result.systemSent).toBe(false);
|
||||||
|
expect(result.sessionEntry.modelOverride).toBe("sonnet-4");
|
||||||
|
expect(result.sessionEntry.providerOverride).toBe("anthropic");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("creates new sessionId when entry exists but has no sessionId", () => {
|
it("creates new sessionId when entry exists but has no sessionId", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user