mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 23:40:42 +00:00
test: tighten synology chat context assertions
This commit is contained in:
@@ -28,6 +28,13 @@ function makeStartContext<T>(cfg: T, accountId: string, abortSignal: AbortSignal
|
||||
};
|
||||
}
|
||||
|
||||
function requireRecord(value: unknown, label: string): Record<string, unknown> {
|
||||
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
||||
throw new Error(`expected ${label} to be a record`);
|
||||
}
|
||||
return value as Record<string, unknown>;
|
||||
}
|
||||
|
||||
describe("Synology channel wiring integration", () => {
|
||||
beforeAll(async () => {
|
||||
({ createSynologyChatPlugin } = await import("./channel.js"));
|
||||
@@ -173,14 +180,12 @@ describe("Synology channel wiring integration", () => {
|
||||
|
||||
const alphaCtx = finalizeInboundContextMock.mock.calls[0]?.[0];
|
||||
const betaCtx = finalizeInboundContextMock.mock.calls[1]?.[0];
|
||||
expect(alphaCtx).toMatchObject({
|
||||
AccountId: "alpha",
|
||||
SessionKey: "agent:agent-alpha:synology-chat:alpha:direct:123",
|
||||
});
|
||||
expect(betaCtx).toMatchObject({
|
||||
AccountId: "beta",
|
||||
SessionKey: "agent:agent-beta:synology-chat:beta:direct:123",
|
||||
});
|
||||
const alphaContext = requireRecord(alphaCtx, "alpha inbound context");
|
||||
expect(alphaContext.AccountId).toBe("alpha");
|
||||
expect(alphaContext.SessionKey).toBe("agent:agent-alpha:synology-chat:alpha:direct:123");
|
||||
const betaContext = requireRecord(betaCtx, "beta inbound context");
|
||||
expect(betaContext.AccountId).toBe("beta");
|
||||
expect(betaContext.SessionKey).toBe("agent:agent-beta:synology-chat:beta:direct:123");
|
||||
|
||||
alphaAbortController.abort();
|
||||
betaAbortController.abort();
|
||||
|
||||
Reference in New Issue
Block a user