* Tests: stabilize detect-secrets fixtures * Tests: fix rebased detect-secrets false positives * Docs: keep snippets valid under detect-secrets * Tests: finalize detect-secrets false-positive fixes * Tests: reduce detect-secrets false positives * Tests: keep detect-secrets pragmas inline * Tests: remediate next detect-secrets batch * Tests: tighten detect-secrets allowlists * Tests: stabilize detect-secrets formatter drift
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { validateConfigObject } from "./config.js";
|
|
|
|
describe("Telegram webhookPort config", () => {
|
|
it("accepts a positive webhookPort", () => {
|
|
const res = validateConfigObject({
|
|
channels: {
|
|
telegram: {
|
|
webhookUrl: "https://example.com/telegram-webhook",
|
|
webhookSecret: "secret", // pragma: allowlist secret
|
|
webhookPort: 8787,
|
|
},
|
|
},
|
|
});
|
|
expect(res.ok).toBe(true);
|
|
});
|
|
|
|
it("accepts webhookPort set to 0 for ephemeral port binding", () => {
|
|
const res = validateConfigObject({
|
|
channels: {
|
|
telegram: {
|
|
webhookUrl: "https://example.com/telegram-webhook",
|
|
webhookSecret: "secret", // pragma: allowlist secret
|
|
webhookPort: 0,
|
|
},
|
|
},
|
|
});
|
|
expect(res.ok).toBe(true);
|
|
});
|
|
|
|
it("rejects negative webhookPort", () => {
|
|
const res = validateConfigObject({
|
|
channels: {
|
|
telegram: {
|
|
webhookUrl: "https://example.com/telegram-webhook",
|
|
webhookSecret: "secret", // pragma: allowlist secret
|
|
webhookPort: -1,
|
|
},
|
|
},
|
|
});
|
|
expect(res.ok).toBe(false);
|
|
if (!res.ok) {
|
|
expect(res.issues.some((issue) => issue.path === "channels.telegram.webhookPort")).toBe(true);
|
|
}
|
|
});
|
|
});
|