mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 06:14:23 +00:00
test: tighten outbound session context coverage
This commit is contained in:
@@ -20,6 +20,19 @@ describe("buildOutboundSessionContext", () => {
|
||||
expect(resolveSessionAgentIdMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns only the explicit trimmed agent id when no session key is present", () => {
|
||||
expect(
|
||||
buildOutboundSessionContext({
|
||||
cfg: {} as never,
|
||||
sessionKey: " ",
|
||||
agentId: " explicit-agent ",
|
||||
}),
|
||||
).toEqual({
|
||||
agentId: "explicit-agent",
|
||||
});
|
||||
expect(resolveSessionAgentIdMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("derives the agent id from the trimmed session key when no explicit agent is given", () => {
|
||||
resolveSessionAgentIdMock.mockReturnValueOnce("derived-agent");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user