fix(telegram): move network fallback to resolver-scoped dispatchers (#40740)

Merged via squash.

Prepared head SHA: a4456d48b4
Co-authored-by: sircrumpet <4436535+sircrumpet@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
Eugene
2026-03-10 15:58:51 +10:00
committed by GitHub
parent d1a59557b5
commit 45b74fb56c
23 changed files with 1641 additions and 390 deletions

View File

@@ -2,16 +2,22 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
let collectTelegramUnmentionedGroupIds: typeof import("./audit.js").collectTelegramUnmentionedGroupIds;
let auditTelegramGroupMembership: typeof import("./audit.js").auditTelegramGroupMembership;
const undiciFetch = vi.hoisted(() => vi.fn());
vi.mock("undici", async (importOriginal) => {
const actual = await importOriginal<typeof import("undici")>();
return {
...actual,
fetch: undiciFetch,
};
});
function mockGetChatMemberStatus(status: string) {
vi.stubGlobal(
"fetch",
vi.fn().mockResolvedValueOnce(
new Response(JSON.stringify({ ok: true, result: { status } }), {
status: 200,
headers: { "Content-Type": "application/json" },
}),
),
undiciFetch.mockResolvedValueOnce(
new Response(JSON.stringify({ ok: true, result: { status } }), {
status: 200,
headers: { "Content-Type": "application/json" },
}),
);
}
@@ -31,7 +37,7 @@ describe("telegram audit", () => {
});
beforeEach(() => {
vi.unstubAllGlobals();
undiciFetch.mockReset();
});
it("collects unmentioned numeric group ids and flags wildcard", async () => {