






















@@ -256,21 +256,23 @@ describe("createSynologyChatPlugin", () => {
256256const plugin = createSynologyChatPlugin();
257257const account = makeSecurityAccount({ token: "" });
258258const warnings = plugin.security.collectWarnings({ cfg: {}, account });
259-expect(warnings.some((w: string) => w.includes("token"))).toBe(true);
259+expect(warnings).toEqual(expect.arrayContaining([expect.stringContaining("token")]));
260260});
261261262262it("warns when allowInsecureSsl is true", () => {
263263const plugin = createSynologyChatPlugin();
264264const account = makeSecurityAccount({ allowInsecureSsl: true });
265265const warnings = plugin.security.collectWarnings({ cfg: {}, account });
266-expect(warnings.some((w: string) => w.includes("SSL"))).toBe(true);
266+expect(warnings).toEqual(expect.arrayContaining([expect.stringContaining("SSL")]));
267267});
268268269269it("warns when dangerous name matching is enabled", () => {
270270const plugin = createSynologyChatPlugin();
271271const account = makeSecurityAccount({ dangerouslyAllowNameMatching: true });
272272const warnings = plugin.security.collectWarnings({ cfg: {}, account });
273-expect(warnings.some((w: string) => w.includes("dangerouslyAllowNameMatching"))).toBe(true);
273+expect(warnings).toEqual(
274+expect.arrayContaining([expect.stringContaining("dangerouslyAllowNameMatching")]),
275+);
274276});
275277276278it("warns when inherited shared webhookPath is dangerously re-enabled", () => {
@@ -281,39 +283,45 @@ describe("createSynologyChatPlugin", () => {
281283dangerouslyAllowInheritedWebhookPath: true,
282284});
283285const warnings = plugin.security.collectWarnings({ cfg: {}, account });
284-expect(
285-warnings.some((w: string) => w.includes("dangerouslyAllowInheritedWebhookPath=true")),
286-).toBe(true);
286+expect(warnings).toEqual(
287+expect.arrayContaining([
288+expect.stringContaining("dangerouslyAllowInheritedWebhookPath=true"),
289+]),
290+);
287291});
288292289293it("warns when dmPolicy is open", () => {
290294const plugin = createSynologyChatPlugin();
291295const account = makeSecurityAccount({ dmPolicy: "open", allowedUserIds: ["*"] });
292296const warnings = plugin.security.collectWarnings({ cfg: {}, account });
293-expect(warnings.some((w: string) => w.includes("open"))).toBe(true);
297+expect(warnings).toEqual(expect.arrayContaining([expect.stringContaining("open")]));
294298});
295299296300it("warns when dmPolicy is open and allowedUserIds is empty", () => {
297301const plugin = createSynologyChatPlugin();
298302const account = makeSecurityAccount({ dmPolicy: "open", allowedUserIds: [] });
299303const warnings = plugin.security.collectWarnings({ cfg: {}, account });
300-expect(warnings.some((w: string) => w.includes("empty allowedUserIds"))).toBe(true);
304+expect(warnings).toEqual(
305+expect.arrayContaining([expect.stringContaining("empty allowedUserIds")]),
306+);
301307});
302308303309it("warns when dmPolicy is allowlist and allowedUserIds is empty", () => {
304310const plugin = createSynologyChatPlugin();
305311const account = makeSecurityAccount();
306312const warnings = plugin.security.collectWarnings({ cfg: {}, account });
307-expect(warnings.some((w: string) => w.includes("empty allowedUserIds"))).toBe(true);
313+expect(warnings).toEqual(
314+expect.arrayContaining([expect.stringContaining("empty allowedUserIds")]),
315+);
308316});
309317310318it("warns when named multi-account routes inherit a shared webhookPath", () => {
311319const plugin = createSynologyChatPlugin();
312320const cfg = makeSharedWebhookConfig();
313321const account = plugin.config.resolveAccount(cfg, "alerts");
314322const warnings = plugin.security.collectWarnings({ cfg, account });
315-expect(warnings.some((w: string) => w.includes("must set an explicit webhookPath"))).toBe(
316-true,
323+expect(warnings).toEqual(
324+expect.arrayContaining([expect.stringContaining("must set an explicit webhookPath")]),
317325);
318326});
319327@@ -334,7 +342,9 @@ describe("createSynologyChatPlugin", () => {
334342};
335343const account = plugin.config.resolveAccount(cfg, "alerts");
336344const warnings = plugin.security.collectWarnings({ cfg, account });
337-expect(warnings.some((w: string) => w.includes("conflicts on webhookPath"))).toBe(true);
345+expect(warnings).toEqual(
346+expect.arrayContaining([expect.stringContaining("conflicts on webhookPath")]),
347+);
338348});
339349340350it("returns no warnings for fully configured account", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。