mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:11:36 +00:00
feat: add session origin metadata helpers
This commit is contained in:
23
src/config/sessions/metadata.test.ts
Normal file
23
src/config/sessions/metadata.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { deriveSessionMetaPatch } from "./metadata.js";
|
||||
|
||||
describe("deriveSessionMetaPatch", () => {
|
||||
it("captures origin + group metadata", () => {
|
||||
const patch = deriveSessionMetaPatch({
|
||||
ctx: {
|
||||
Provider: "whatsapp",
|
||||
ChatType: "group",
|
||||
GroupSubject: "Family",
|
||||
From: "123@g.us",
|
||||
},
|
||||
sessionKey: "agent:main:whatsapp:group:123@g.us",
|
||||
});
|
||||
|
||||
expect(patch?.origin?.label).toBe("Family id:123@g.us");
|
||||
expect(patch?.origin?.provider).toBe("whatsapp");
|
||||
expect(patch?.subject).toBe("Family");
|
||||
expect(patch?.channel).toBe("whatsapp");
|
||||
expect(patch?.groupId).toBe("123@g.us");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user