test: clear msteams gate drift for gateway probe auth landing (#52513) (thanks @CodeForgeNet)

This commit is contained in:
Peter Steinberger 2026-03-23 02:13:42 +00:00
parent 24f77d7457
commit 339a67262d
1 changed files with 7 additions and 6 deletions

View File

@ -1,15 +1,16 @@
import type { Server } from "node:http";
import { describe, expect, it, vi } from "vitest";
import { applyMSTeamsWebhookTimeouts } from "./webhook-timeouts.js";
describe("applyMSTeamsWebhookTimeouts", () => {
it("applies default timeouts and header clamp", () => {
const httpServer = {
const httpServer: Pick<Server, "setTimeout" | "requestTimeout" | "headersTimeout"> = {
setTimeout: vi.fn(),
requestTimeout: 0,
headersTimeout: 0,
} as never;
};
applyMSTeamsWebhookTimeouts(httpServer);
applyMSTeamsWebhookTimeouts(httpServer as Server);
expect(httpServer.setTimeout).toHaveBeenCalledWith(30_000);
expect(httpServer.requestTimeout).toBe(30_000);
@ -17,13 +18,13 @@ describe("applyMSTeamsWebhookTimeouts", () => {
});
it("uses explicit overrides and clamps headers timeout to request timeout", () => {
const httpServer = {
const httpServer: Pick<Server, "setTimeout" | "requestTimeout" | "headersTimeout"> = {
setTimeout: vi.fn(),
requestTimeout: 0,
headersTimeout: 0,
} as never;
};
applyMSTeamsWebhookTimeouts(httpServer, {
applyMSTeamsWebhookTimeouts(httpServer as Server, {
inactivityTimeoutMs: 12_000,
requestTimeoutMs: 9_000,
headersTimeoutMs: 15_000,