mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: update permission count tests for new enterprise permissions
This commit is contained in:
@@ -192,8 +192,8 @@ describe("hasEffectivePermission", () => {
|
||||
|
||||
describe("getPermissions", () => {
|
||||
describe("exact counts for built-in roles", () => {
|
||||
it("admin has exactly 14 permissions", async () => {
|
||||
expect(await getPermissions("admin")).toHaveLength(14);
|
||||
it("admin has exactly 17 permissions", async () => {
|
||||
expect(await getPermissions("admin")).toHaveLength(17);
|
||||
});
|
||||
|
||||
it("editor has exactly 7 permissions", async () => {
|
||||
|
||||
@@ -25,9 +25,9 @@ import { getPermissions, hasPermission } from "../../../apps/api/src/permissions
|
||||
|
||||
describe("permissions", () => {
|
||||
describe("getPermissions", () => {
|
||||
it("returns all 14 permissions for admin", async () => {
|
||||
it("returns all 17 permissions for admin", async () => {
|
||||
const perms = await getPermissions("admin");
|
||||
expect(perms).toHaveLength(14);
|
||||
expect(perms).toHaveLength(17);
|
||||
expect(perms).toContain("tools:use");
|
||||
expect(perms).toContain("files:own");
|
||||
expect(perms).toContain("files:all");
|
||||
@@ -42,6 +42,9 @@ describe("permissions", () => {
|
||||
expect(perms).toContain("features:manage");
|
||||
expect(perms).toContain("system:health");
|
||||
expect(perms).toContain("audit:read");
|
||||
expect(perms).toContain("compliance:manage");
|
||||
expect(perms).toContain("webhooks:manage");
|
||||
expect(perms).toContain("security:manage");
|
||||
});
|
||||
|
||||
it("returns only basic permissions for user role", async () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ vi.mock("../../../apps/api/src/plugins/auth.js", () => ({
|
||||
import { getPermissions, hasPermission } from "../../../apps/api/src/permissions.js";
|
||||
|
||||
describe("role permissions", () => {
|
||||
it("admin has all 14 permissions", async () => {
|
||||
it("admin has all 17 permissions", async () => {
|
||||
const perms = await getPermissions("admin");
|
||||
expect(perms).toContain("tools:use");
|
||||
expect(perms).toContain("files:all");
|
||||
@@ -24,7 +24,10 @@ describe("role permissions", () => {
|
||||
expect(perms).toContain("features:manage");
|
||||
expect(perms).toContain("system:health");
|
||||
expect(perms).toContain("audit:read");
|
||||
expect(perms.length).toBe(14);
|
||||
expect(perms).toContain("compliance:manage");
|
||||
expect(perms).toContain("webhooks:manage");
|
||||
expect(perms).toContain("security:manage");
|
||||
expect(perms.length).toBe(17);
|
||||
});
|
||||
|
||||
it("editor has collaborative but not admin permissions", async () => {
|
||||
|
||||
Reference in New Issue
Block a user