Files
bun.sh/test/bun.js/body-mixin-errors.test.ts
2022-10-15 21:34:05 -07:00

18 lines
432 B
TypeScript

import { it, describe, expect } 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) {
expect(e.message).toBe("Body already used");
}
});
});