mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add test for body mixin error
This commit is contained in:
17
test/bun.js/body-mixin-errors.test.ts
Normal file
17
test/bun.js/body-mixin-errors.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user