mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
added format command and added trailing commas to reduce conflicts
This commit is contained in:
@@ -7,13 +7,13 @@ describe("authorize", () => {
|
||||
["read", "write"],
|
||||
{
|
||||
admin: {
|
||||
permissions: ["read", "write"]
|
||||
}
|
||||
permissions: ["read", "write"],
|
||||
},
|
||||
},
|
||||
{ enabled: true }
|
||||
{ enabled: true },
|
||||
);
|
||||
const user = {
|
||||
role: "admin"
|
||||
role: "admin",
|
||||
};
|
||||
|
||||
expect(guard.granted("read", user)).toBe(true);
|
||||
@@ -27,21 +27,21 @@ describe("authorize", () => {
|
||||
["read", "write"],
|
||||
{
|
||||
admin: {
|
||||
permissions: ["read", "write"]
|
||||
permissions: ["read", "write"],
|
||||
},
|
||||
guest: {
|
||||
permissions: ["read"],
|
||||
is_default: true
|
||||
}
|
||||
is_default: true,
|
||||
},
|
||||
},
|
||||
{ enabled: true }
|
||||
{ enabled: true },
|
||||
);
|
||||
|
||||
expect(guard.granted("read")).toBe(true);
|
||||
expect(guard.granted("write")).toBe(false);
|
||||
|
||||
const user = {
|
||||
role: "admin"
|
||||
role: "admin",
|
||||
};
|
||||
|
||||
expect(guard.granted("read", user)).toBe(true);
|
||||
@@ -58,12 +58,12 @@ describe("authorize", () => {
|
||||
test("role implicit allow", async () => {
|
||||
const guard = Guard.create(["read", "write"], {
|
||||
admin: {
|
||||
implicit_allow: true
|
||||
}
|
||||
implicit_allow: true,
|
||||
},
|
||||
});
|
||||
|
||||
const user = {
|
||||
role: "admin"
|
||||
role: "admin",
|
||||
};
|
||||
|
||||
expect(guard.granted("read", user)).toBe(true);
|
||||
@@ -74,8 +74,8 @@ describe("authorize", () => {
|
||||
const guard = Guard.create(["read", "write"], {
|
||||
guest: {
|
||||
implicit_allow: true,
|
||||
is_default: true
|
||||
}
|
||||
is_default: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(guard.getUserRole()?.name).toBe("guest");
|
||||
|
||||
@@ -8,9 +8,9 @@ describe("OAuthStrategy", async () => {
|
||||
type: "oidc",
|
||||
client: {
|
||||
client_id: process.env.OAUTH_CLIENT_ID,
|
||||
client_secret: process.env.OAUTH_CLIENT_SECRET
|
||||
client_secret: process.env.OAUTH_CLIENT_SECRET,
|
||||
},
|
||||
name: "google"
|
||||
name: "google",
|
||||
});
|
||||
const state = "---";
|
||||
const redirect_uri = "http://localhost:3000/auth/google/callback";
|
||||
@@ -21,7 +21,7 @@ describe("OAuthStrategy", async () => {
|
||||
|
||||
const request = await strategy.request({
|
||||
redirect_uri,
|
||||
state
|
||||
state,
|
||||
});
|
||||
|
||||
const server = Bun.serve({
|
||||
@@ -31,13 +31,13 @@ describe("OAuthStrategy", async () => {
|
||||
console.log("req", req);
|
||||
const user = await strategy.callback(url, {
|
||||
redirect_uri,
|
||||
state
|
||||
state,
|
||||
});
|
||||
|
||||
console.log("---user", user);
|
||||
}
|
||||
return new Response("Bun!");
|
||||
}
|
||||
},
|
||||
});
|
||||
console.log("request", request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user