mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
fix: align channel owner context test types
This commit is contained in:
@@ -11,6 +11,8 @@ export type StoredConversationReference = {
|
||||
lastSeenAt?: string;
|
||||
/** Activity ID from the last message */
|
||||
activityId?: string;
|
||||
/** Channel thread root activity ID for threaded replies. */
|
||||
threadId?: string;
|
||||
/** User who sent the message */
|
||||
user?: { id?: string; name?: string; aadObjectId?: string };
|
||||
/** Agent/bot that received the message */
|
||||
|
||||
@@ -558,12 +558,15 @@ describe("msteams monitor handler authz", () => {
|
||||
} as unknown as Parameters<typeof handler>[0]);
|
||||
|
||||
expect(conversationStore.upsert).toHaveBeenCalledTimes(1);
|
||||
const storedArg = conversationStore.upsert.mock.calls[0]?.[1] as Record<string, unknown>;
|
||||
expect(storedArg).toBeDefined();
|
||||
// Top-level tenantId must not be present when no source is available.
|
||||
expect(storedArg.tenantId).toBeUndefined();
|
||||
// aadObjectId still captured from `from.aadObjectId` when present.
|
||||
expect(storedArg.aadObjectId).toBe("sender-aad");
|
||||
expect(conversationStore.upsert).toHaveBeenCalledWith(
|
||||
"19:no-tenant@thread.tacv2",
|
||||
expect.not.objectContaining({ tenantId: expect.anything() }),
|
||||
);
|
||||
expect(conversationStore.upsert).toHaveBeenCalledWith(
|
||||
"19:no-tenant@thread.tacv2",
|
||||
expect.objectContaining({ aadObjectId: "sender-aad" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("logs an info drop reason when dmPolicy allowlist rejects a sender", async () => {
|
||||
|
||||
@@ -168,6 +168,7 @@ vi.mock("../logging/subsystem.js", () => ({
|
||||
|
||||
vi.mock("../routing/session-key.js", () => ({
|
||||
normalizeAgentId: (id: string) => id,
|
||||
normalizeMainKey: (key?: string) => key ?? "main",
|
||||
}));
|
||||
|
||||
vi.mock("../runtime.js", () => ({
|
||||
|
||||
@@ -50,6 +50,8 @@ vi.mock("../../infra/skills-remote.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../routing/session-key.js", () => ({
|
||||
normalizeAgentId: (id: string) => id,
|
||||
normalizeMainKey: (key?: string) => key ?? "main",
|
||||
resolveAgentIdFromSessionKey: resolveAgentIdFromSessionKeyMock,
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user