Harden Telegram poll gating and schema consistency (#36547)

Merged via squash.

Prepared head SHA: f77824419e
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-03-05 19:24:43 -05:00
committed by GitHub
parent f771ba8de9
commit 6dfd39c32f
27 changed files with 1129 additions and 65 deletions

View File

@@ -48,6 +48,16 @@ describe("readNumberParam", () => {
expect(readNumberParam(params, "messageId")).toBe(42);
});
it("keeps partial parse behavior by default", () => {
const params = { messageId: "42abc" };
expect(readNumberParam(params, "messageId")).toBe(42);
});
it("rejects partial numeric strings when strict is enabled", () => {
const params = { messageId: "42abc" };
expect(readNumberParam(params, "messageId", { strict: true })).toBeUndefined();
});
it("truncates when integer is true", () => {
const params = { messageId: "42.9" };
expect(readNumberParam(params, "messageId", { integer: true })).toBe(42);