mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
33 lines
913 B
TypeScript
33 lines
913 B
TypeScript
import { describe, test, expect } from "bun:test";
|
|
|
|
test("zero args returns an otherwise empty 200 response", () => {
|
|
const response = new Response();
|
|
expect(response.status).toBe(200);
|
|
expect(response.statusText).toBe("");
|
|
});
|
|
|
|
test("1-arg form returns a 200 response", () => {
|
|
const response = new Response("body text");
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.statusText).toBe("");
|
|
});
|
|
|
|
describe("2-arg form", () => {
|
|
test("can fill in status/statusText, and it works", () => {
|
|
const response = new Response("body text", {
|
|
status: 202,
|
|
statusText: "Accepted.",
|
|
});
|
|
|
|
expect(response.status).toBe(202);
|
|
expect(response.statusText).toBe("Accepted.");
|
|
});
|
|
test('empty object continues to return 200/""', () => {
|
|
const response = new Response("body text", {});
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.statusText).toBe("");
|
|
});
|
|
});
|