Files
WRNexusJS/packages/authz/test/exports.test.ts
T
Clintchiz 6f3a53b9ff feat(authz): export registry, store, engine, and middleware surface
Appends the Task 1-8 modules (defineAuthz, catalog merge helpers,
permission stores, audit sinks, resolver engine, and authzMiddleware/
can/guards) to the public @wrnexus/authz surface, and regenerates the
public-api-0.8.json baseline to match.
2026-08-04 19:29:08 +05:30

51 lines
1.2 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import * as authz from "../src/index.ts";
describe("@wrnexus/authz exports", () => {
test("keeps the pre-existing surface", () => {
for (const name of [
"defineRbac",
"hasRole",
"any",
"all",
"attr",
"authorize",
"requireRole",
"requirePermission",
"allow",
"deny",
"decision",
"owner",
"anyDecision",
"allDecisions",
"authorizeDecision",
"filterAuthorized",
]) {
expect(typeof (authz as Record<string, unknown>)[name]).toBe("function");
}
});
test("adds the registry, store, engine, and middleware surface", () => {
for (const name of [
"defineAuthz",
"mergeCatalogs",
"emptyCatalog",
"memoryPermissionStore",
"cachedPermissionStore",
"memoryAuditSink",
"consoleAuditSink",
"createAuthzResolver",
"expandRoles",
"permissionMatches",
"deniedBy",
"authzMiddleware",
"can",
"decideFor",
"guardPermission",
"filterCan",
]) {
expect(typeof (authz as Record<string, unknown>)[name]).toBe("function");
}
});
});