Files
bun.sh/test/js/web/fetch/body-mixin-errors.test.ts
2024-09-03 21:32:52 -07:00

18 lines
437 B
TypeScript

import { describe, expect, it } from "bun:test";
describe("body-mixin-errors", () => {
it("should fail when bodyUsed", async () => {
var res = new Response("a");
expect(res.bodyUsed).toBe(false);
await res.text();
expect(res.bodyUsed).toBe(true);
try {
await res.text();
throw new Error("should not get here");
} catch (e: any) {
expect(e.message).toBe("Body already used");
}
});
});