mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
exposed bknd middlewares to be used for custom routes
This commit is contained in:
@@ -1,9 +1 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { shouldSkipAuth } from "../../src/auth/middlewares";
|
||||
|
||||
describe("auth middleware", () => {
|
||||
it("should skip auth on asset paths", () => {
|
||||
expect(shouldSkipAuth(new Request("http://localhost/assets/test.js"))).toBe(true);
|
||||
expect(shouldSkipAuth(new Request("http://localhost/"))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ describe("AppAuth", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("registers auth middleware automatically", async () => {
|
||||
test("registers auth middleware for bknd routes only", async () => {
|
||||
const app = createApp({
|
||||
initialConfig: {
|
||||
auth: {
|
||||
@@ -101,7 +101,7 @@ describe("AppAuth", () => {
|
||||
await app.server.request("/api/system/ping");
|
||||
await app.server.request("/test");
|
||||
|
||||
expect(spy.mock.calls.length).toBe(2);
|
||||
expect(spy.mock.calls.length).toBe(1);
|
||||
});
|
||||
|
||||
test("should allow additional user fields", async () => {
|
||||
|
||||
Reference in New Issue
Block a user