Skip to content

Commit

Permalink
chore: add further tests (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Oct 9, 2023
1 parent 07d1c15 commit d5a048f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions e2e_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,18 @@ Deno.test("[e2e] POST /api/vote", async (test) => {

assertEquals(resp.status, Status.Created);
});

await test.step("serves an error response if the `item_id` URL parameter is missing", async () => {
const resp = await handler(
new Request("http://localhost/api/vote", {
method: "POST",
headers: { cookie: "site-session=" + user.sessionId },
}),
);

assertEquals(resp.status, Status.BadRequest);
assertEquals(await resp.text(), "`item_id` URL parameter missing");
});
});

function createStripeEvent(
Expand Down
6 changes: 6 additions & 0 deletions utils/db_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ Deno.test("[db] user", async () => {
...user,
sessionId: newSessionId,
});

await assertRejects(
async () => await updateUserSession(user, newSessionId),
Error,
"Failed to update user session",
);
});

Deno.test("[db] votes", async () => {
Expand Down

0 comments on commit d5a048f

Please sign in to comment.