Skip to content

Commit

Permalink
Specify UNAUTHORIZED as error
Browse files Browse the repository at this point in the history
  • Loading branch information
canjalal committed Oct 17, 2024
1 parent 5258bc4 commit 013b29e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/routers/admin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ test("getPostgresInfo", async (t) => {
test("getPostgresInfo (throws if not admin)", async (t) => {
const { trpc } = await getTestServer(t, { authenticateAs: UserType.Para });

await t.throwsAsync(async () => {
const error = await t.throwsAsync(async () => {
await trpc.admin.getPostgresInfo.query();
});

t.is(
error?.message,
"UNAUTHORIZED",
"Expected an 'unauthorized' error message"
);
});

0 comments on commit 013b29e

Please sign in to comment.