Skip to content

Commit

Permalink
add node 16 guards
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 10, 2023
1 parent c2b4c9d commit f5984a2
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe("app", () => {
expect(JSON.parse(res.text).statusMessage).toBe("test");
});

it("Web Stream", async () => {
it.skipIf(typeof ReadableStream === undefined)("Web Stream", async () => {
app.use(
eventHandler(() => {
return new ReadableStream({
Expand All @@ -120,24 +120,27 @@ describe("app", () => {
expect(res.header["transfer-encoding"]).toBe("chunked");
});

it("Web Stream with Error", async () => {
app.use(
eventHandler(() => {
return new ReadableStream({
start() {
throw createError({
statusCode: 500,
statusText: "test",
});
},
});
})
);
const res = await request.get("/");
it.skipIf(typeof ReadableStream === undefined)(
"Web Stream with Error",
async () => {
app.use(
eventHandler(() => {
return new ReadableStream({
start() {
throw createError({
statusCode: 500,
statusText: "test",
});
},
});
})
);
const res = await request.get("/");

expect(res.statusCode).toBe(500);
expect(JSON.parse(res.text).statusMessage).toBe("test");
});
expect(res.statusCode).toBe(500);
expect(JSON.parse(res.text).statusMessage).toBe("test");
}
);

it("can return HTML directly", async () => {
app.use(eventHandler(() => "<h1>Hello world!</h1>"));
Expand Down

0 comments on commit f5984a2

Please sign in to comment.