mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:18:26 +00:00
refactor: add inbound context helpers
This commit is contained in:
20
src/channels/chat-type.test.ts
Normal file
20
src/channels/chat-type.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { normalizeChatType } from "./chat-type.js";
|
||||
|
||||
describe("normalizeChatType", () => {
|
||||
it("normalizes common inputs", () => {
|
||||
expect(normalizeChatType("direct")).toBe("direct");
|
||||
expect(normalizeChatType("dm")).toBe("direct");
|
||||
expect(normalizeChatType("group")).toBe("group");
|
||||
expect(normalizeChatType("channel")).toBe("channel");
|
||||
expect(normalizeChatType("room")).toBe("channel");
|
||||
});
|
||||
|
||||
it("returns undefined for empty/unknown values", () => {
|
||||
expect(normalizeChatType(undefined)).toBeUndefined();
|
||||
expect(normalizeChatType("")).toBeUndefined();
|
||||
expect(normalizeChatType("nope")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user