|
1 | 1 | // Channel config tests cover channel config normalization and account lookup behavior. |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | | -import type { MsgContext } from "../auto-reply/templating.js"; |
4 | 3 | import { typedCases } from "../test-utils/typed-cases.js"; |
5 | 4 | import { |
6 | 5 | type ChannelMatchSource, |
@@ -12,7 +11,6 @@ import {
|
12 | 11 | applyChannelMatchMeta, |
13 | 12 | resolveChannelMatchConfig, |
14 | 13 | } from "./channel-config.js"; |
15 | | -import { validateSenderIdentity } from "./sender-identity.js"; |
16 | 14 | |
17 | 15 | describe("buildChannelKeyCandidates", () => { |
18 | 16 | it("dedupes and trims keys", () => { |
@@ -136,33 +134,6 @@ describe("resolveChannelMatchConfig", () => {
|
136 | 134 | }); |
137 | 135 | }); |
138 | 136 | |
139 | | -describe("validateSenderIdentity", () => { |
140 | | -it("allows direct messages without sender fields", () => { |
141 | | -const ctx: MsgContext = { ChatType: "direct" }; |
142 | | -expect(validateSenderIdentity(ctx)).toStrictEqual([]); |
143 | | -}); |
144 | | - |
145 | | -it("requires some sender identity for non-direct chats", () => { |
146 | | -const ctx: MsgContext = { ChatType: "group" }; |
147 | | -expect(validateSenderIdentity(ctx)).toContain( |
148 | | -"missing sender identity (SenderId/SenderName/SenderUsername/SenderE164)", |
149 | | -); |
150 | | -}); |
151 | | - |
152 | | -it("validates SenderE164 and SenderUsername shape", () => { |
153 | | -const ctx: MsgContext = { |
154 | | -ChatType: "group", |
155 | | -SenderE164: "123", |
156 | | -SenderUsername: "@ada lovelace", |
157 | | -}; |
158 | | -expect(validateSenderIdentity(ctx)).toEqual([ |
159 | | -"invalid SenderE164: 123", |
160 | | -'SenderUsername should not include "@": @ada lovelace', |
161 | | -"SenderUsername should not include whitespace: @ada lovelace", |
162 | | -]); |
163 | | -}); |
164 | | -}); |
165 | | - |
166 | 137 | describe("resolveNestedAllowlistDecision", () => { |
167 | 138 | const cases = [ |
168 | 139 | { |
|