mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
test: remove low-value direct metadata-mapping unit case
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
|||||||
loadSessionStore,
|
loadSessionStore,
|
||||||
updateSessionStore,
|
updateSessionStore,
|
||||||
} from "../sessions.js";
|
} from "../sessions.js";
|
||||||
import { deriveSessionMetaPatch } from "./metadata.js";
|
|
||||||
import {
|
import {
|
||||||
resolveSessionFilePath,
|
resolveSessionFilePath,
|
||||||
resolveSessionTranscriptPathInDir,
|
resolveSessionTranscriptPathInDir,
|
||||||
@@ -22,26 +21,6 @@ import {
|
|||||||
resolveMirroredTranscriptText,
|
resolveMirroredTranscriptText,
|
||||||
} from "./transcript.js";
|
} from "./transcript.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");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("session path safety", () => {
|
describe("session path safety", () => {
|
||||||
it("rejects unsafe session IDs", () => {
|
it("rejects unsafe session IDs", () => {
|
||||||
expect(() => validateSessionId("../etc/passwd")).toThrow(/Invalid session ID/);
|
expect(() => validateSessionId("../etc/passwd")).toThrow(/Invalid session ID/);
|
||||||
|
|||||||
Reference in New Issue
Block a user