Matrix: clear undici test override after transport test

This commit is contained in:
Gustavo Madeira Santana 2026-04-05 22:34:26 -04:00
parent fb639fa3d5
commit 73a8dd43bf
1 changed files with 10 additions and 2 deletions

View File

@ -1,13 +1,21 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { MatrixMediaSizeLimitError } from "../media-errors.js";
import { performMatrixRequest } from "./transport.js";
const TEST_UNDICI_RUNTIME_DEPS_KEY = "__OPENCLAW_TEST_UNDICI_RUNTIME_DEPS__";
function clearTestUndiciRuntimeDepsOverride(): void {
Reflect.deleteProperty(globalThis as object, TEST_UNDICI_RUNTIME_DEPS_KEY);
}
describe("performMatrixRequest", () => {
beforeEach(() => {
vi.unstubAllGlobals();
Reflect.deleteProperty(globalThis as object, TEST_UNDICI_RUNTIME_DEPS_KEY);
clearTestUndiciRuntimeDepsOverride();
});
afterEach(() => {
clearTestUndiciRuntimeDepsOverride();
});
it("rejects oversized raw responses before buffering the whole body", async () => {