fix: polish Google Chat plugin (#1635) (thanks @iHildy)
Co-authored-by: Ian Hildebrand <ian@jedi.net>
This commit is contained in:
27
extensions/googlechat/src/monitor.test.ts
Normal file
27
extensions/googlechat/src/monitor.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { isSenderAllowed } from "./monitor.js";
|
||||
|
||||
describe("isSenderAllowed", () => {
|
||||
it("matches allowlist entries with users/<email>", () => {
|
||||
expect(
|
||||
isSenderAllowed("users/123", "Jane@Example.com", ["users/jane@example.com"]),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("matches allowlist entries with raw email", () => {
|
||||
expect(isSenderAllowed("users/123", "Jane@Example.com", ["jane@example.com"])).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("still matches user id entries", () => {
|
||||
expect(isSenderAllowed("users/abc", "jane@example.com", ["users/abc"])).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects non-matching emails", () => {
|
||||
expect(isSenderAllowed("users/123", "jane@example.com", ["users/other@example.com"])).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user