refactor(api): extract system role config support
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildSystemRoleConfigUpdateData,
|
||||
systemRoleConfigUpdateInputSchema,
|
||||
} from "../router/system-role-config-support.js";
|
||||
|
||||
describe("system role config support", () => {
|
||||
it("validates the update input schema", () => {
|
||||
expect(systemRoleConfigUpdateInputSchema.parse({
|
||||
role: "ADMIN",
|
||||
label: "Administrators",
|
||||
description: null,
|
||||
color: "#000000",
|
||||
defaultPermissions: ["users.read"],
|
||||
})).toEqual({
|
||||
role: "ADMIN",
|
||||
label: "Administrators",
|
||||
description: null,
|
||||
color: "#000000",
|
||||
defaultPermissions: ["users.read"],
|
||||
});
|
||||
});
|
||||
|
||||
it("builds sparse update payloads", () => {
|
||||
expect(buildSystemRoleConfigUpdateData({
|
||||
role: "MANAGER",
|
||||
description: null,
|
||||
defaultPermissions: ["projects.write"],
|
||||
})).toEqual({
|
||||
description: null,
|
||||
defaultPermissions: ["projects.write"],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user