|
1 | 1 | // Mattermost test support covers monitor.channel kind plugin behavior. |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | | -import { mapMattermostChannelTypeToChatType } from "./monitor-auth.js"; |
| 3 | +import { resolveMattermostTrustedChatKind } from "./monitor-auth.js"; |
4 | 4 |
|
5 | | -describe("mapMattermostChannelTypeToChatType", () => { |
| 5 | +describe("resolveMattermostTrustedChatKind", () => { |
6 | 6 | it("maps direct and group dm channel types", () => { |
7 | | - expect(mapMattermostChannelTypeToChatType("D")).toBe("direct"); |
8 | | - expect(mapMattermostChannelTypeToChatType("g")).toBe("group"); |
| 7 | + expect(resolveMattermostTrustedChatKind({ channelType: "D" })).toBe("direct"); |
| 8 | + expect(resolveMattermostTrustedChatKind({ channelType: "g" })).toBe("group"); |
9 | 9 | }); |
10 | 10 |
|
11 | 11 | it("maps private channels to group", () => { |
12 | | - expect(mapMattermostChannelTypeToChatType("P")).toBe("group"); |
13 | | - expect(mapMattermostChannelTypeToChatType(" p ")).toBe("group"); |
| 12 | + expect(resolveMattermostTrustedChatKind({ channelType: "P" })).toBe("group"); |
| 13 | + expect(resolveMattermostTrustedChatKind({ channelType: " p " })).toBe("group"); |
14 | 14 | }); |
15 | 15 |
|
16 | 16 | it("keeps public channels and unknown typed values as channel", () => { |
17 | | - expect(mapMattermostChannelTypeToChatType("O")).toBe("channel"); |
18 | | - expect(mapMattermostChannelTypeToChatType("x")).toBe("channel"); |
| 17 | + expect(resolveMattermostTrustedChatKind({ channelType: "O" })).toBe("channel"); |
| 18 | + expect(resolveMattermostTrustedChatKind({ channelType: "x" })).toBe("channel"); |
19 | 19 | }); |
20 | 20 |
|
21 | 21 | it("treats missing channel type as direct", () => { |
22 | | - expect(mapMattermostChannelTypeToChatType(undefined)).toBe("direct"); |
23 | | - expect(mapMattermostChannelTypeToChatType(null)).toBe("direct"); |
24 | | - expect(mapMattermostChannelTypeToChatType("")).toBe("direct"); |
| 22 | + expect(resolveMattermostTrustedChatKind({ channelType: undefined })).toBe("direct"); |
| 23 | + expect(resolveMattermostTrustedChatKind({ channelType: null })).toBe("direct"); |
| 24 | + expect(resolveMattermostTrustedChatKind({ channelType: "" })).toBe("direct"); |
25 | 25 | }); |
26 | 26 | }); |
0 commit comments