refactor(api): extract system role config support

This commit is contained in:
2026-03-31 14:00:26 +02:00
parent 6aa0625c8c
commit c839b18d4e
3 changed files with 63 additions and 17 deletions
@@ -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"],
});
});
});