fixed auth tests

This commit is contained in:
dswbx
2025-01-11 11:35:11 +01:00
parent c732566f63
commit 5823c2d245
3 changed files with 32 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
import { App, createApp } from "../../src";
import type { AuthResponse } from "../../src/auth";
import { randomString, secureRandomString } from "../../src/core/utils";
import { randomString, secureRandomString, withDisabledConsole } from "../../src/core/utils";
import { disableConsoleLog, enableConsoleLog } from "../helper";
beforeAll(disableConsoleLog);
@@ -200,4 +200,14 @@ describe("integration auth", () => {
expect(await $fns.me()).toEqual({ user: null as any });
}
});
it("should check for permissions", async () => {
const app = createAuthApp();
await app.build();
await withDisabledConsole(async () => {
const res = await app.server.request("/api/system/schema");
expect(res.status).toBe(403);
});
});
});