Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

614 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { hasInstanceAdminRole } from "../../../apps/api/src/utils/instance-admin-role";

describe("hasInstanceAdminRole", () => {
  it.each(["admin", "user,admin", "admin,user", "admin,"])(
    "accepts %j",
    (role) => {
      expect(hasInstanceAdminRole(role)).toBe(true);
    },
  );

  it.each([
    "user",
    "administrator",
    " admin , user",
    "admin\t",
    "",
    "user,owner",
    null,
    undefined,
    1,
  ])("rejects %j, matching Better Auth's exact tokens", (role) => {
    expect(hasInstanceAdminRole(role)).toBe(false);
  });
});