Skip to content

Commit

Permalink
Add further tests for error handling, improving overall coverage to 9…
Browse files Browse the repository at this point in the history
…4.2%
  • Loading branch information
briward committed Nov 12, 2024
1 parent 07ec308 commit 8db4d0c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/kernel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Deno.test("test middleware catches 404 error", async () => {
const { error } = ctx;

if (error?.status === 404) {
return 'Page not found';
return "Page not found";
}
});

Expand All @@ -104,7 +104,7 @@ Deno.test("test middleware catches server error", async () => {
const { error } = ctx;

if (error?.status === 500) {
return 'Internal server error';
return "Internal server error";
}
});

Expand All @@ -118,16 +118,16 @@ Deno.test("test middleware catches bad request error", async () => {

app.add((_ctx: Context) => {
throw new BadRequest([
'There was an error in validation of field #1',
'There was an error in validation of field #2'
"There was an error in validation of field #1",
"There was an error in validation of field #2",
]);
});

app.add((ctx: Context) => {
const { error } = ctx;

if (error?.status === 400) {
return 'Bad request';
return "Bad request";
}
});

Expand Down

0 comments on commit 8db4d0c

Please sign in to comment.