mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 23:14:32 +00:00
perf(test): consolidate media-understanding misc suites
This commit is contained in:
@@ -1,5 +1,22 @@
|
|||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import { MediaAttachmentCache } from "./attachments.js";
|
import { MediaAttachmentCache } from "./attachments.js";
|
||||||
|
import { normalizeMediaUnderstandingChatType, resolveMediaUnderstandingScope } from "./scope.js";
|
||||||
|
|
||||||
|
describe("media understanding scope", () => {
|
||||||
|
it("normalizes chatType", () => {
|
||||||
|
expect(normalizeMediaUnderstandingChatType("channel")).toBe("channel");
|
||||||
|
expect(normalizeMediaUnderstandingChatType("dm")).toBe("direct");
|
||||||
|
expect(normalizeMediaUnderstandingChatType("room")).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("matches channel chatType explicitly", () => {
|
||||||
|
const scope = {
|
||||||
|
rules: [{ action: "deny", match: { chatType: "channel" } }],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
expect(resolveMediaUnderstandingScope({ scope, chatType: "channel" })).toBe("deny");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const originalFetch = globalThis.fetch;
|
const originalFetch = globalThis.fetch;
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
|
||||||
import { normalizeMediaUnderstandingChatType, resolveMediaUnderstandingScope } from "./scope.js";
|
|
||||||
|
|
||||||
describe("media understanding scope", () => {
|
|
||||||
it("normalizes chatType", () => {
|
|
||||||
expect(normalizeMediaUnderstandingChatType("channel")).toBe("channel");
|
|
||||||
expect(normalizeMediaUnderstandingChatType("dm")).toBe("direct");
|
|
||||||
expect(normalizeMediaUnderstandingChatType("room")).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("matches channel chatType explicitly", () => {
|
|
||||||
const scope = {
|
|
||||||
rules: [{ action: "deny", match: { chatType: "channel" } }],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
expect(resolveMediaUnderstandingScope({ scope, chatType: "channel" })).toBe("deny");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user