forked from baron/baron-sso
custom claim 권한체크 확인
This commit is contained in:
@@ -2,11 +2,13 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildAuthenticatedOrgChartTenantPickerUrl,
|
||||
buildAuthenticatedOrgChartUrl,
|
||||
buildAuthenticatedOrgChartUserMultiPickerUrl,
|
||||
buildOrgChartTenantPickerUrl,
|
||||
filterNonHanmacFamilyTenants,
|
||||
getTenantGradeOptions,
|
||||
isHanmacFamilyUser,
|
||||
parseOrgChartTenantSelection,
|
||||
parseOrgChartUserSelections,
|
||||
} from "./orgChartPicker";
|
||||
|
||||
describe("orgChartPicker", () => {
|
||||
@@ -49,6 +51,16 @@ describe("orgChartPicker", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("builds an authenticated multi picker URL for tenant member selection", () => {
|
||||
expect(
|
||||
buildAuthenticatedOrgChartUserMultiPickerUrl(
|
||||
"https://orgchart.example.com",
|
||||
),
|
||||
).toBe(
|
||||
"https://orgchart.example.com/login?auto=1&returnTo=%2Fembed%2Fpicker%3Fmode%3Dmultiple%26select%3Duser%26width%3D720%26height%3D640%26includeInternal%3Dtrue%26includeDescendants%3Dtrue%26showDescendantToggle%3Dtrue",
|
||||
);
|
||||
});
|
||||
|
||||
it("builds the admin chart navigation URL with internal visibility enabled", () => {
|
||||
expect(buildAuthenticatedOrgChartUrl("https://orgchart.example.com/")).toBe(
|
||||
"https://orgchart.example.com/login?auto=1&returnTo=%2Fchart%3FincludeInternal%3Dtrue",
|
||||
@@ -98,6 +110,39 @@ describe("orgChartPicker", () => {
|
||||
expect(parseOrgChartTenantSelection({ type: "other" })).toBeNull();
|
||||
});
|
||||
|
||||
it("parses user selections from orgfront multi picker messages", () => {
|
||||
expect(
|
||||
parseOrgChartUserSelections({
|
||||
type: "orgfront:picker:confirm",
|
||||
payload: {
|
||||
mode: "multiple",
|
||||
selections: [
|
||||
{ type: "tenant", id: "tenant-1", name: "기술기획" },
|
||||
{
|
||||
type: "user",
|
||||
id: "user-1",
|
||||
name: "홍길동",
|
||||
email: "hong@example.com",
|
||||
},
|
||||
{ type: "user", id: "user-2", name: "김영희" },
|
||||
{ type: "user", id: "", name: "잘못된 사용자" },
|
||||
],
|
||||
},
|
||||
}),
|
||||
).toEqual([
|
||||
{
|
||||
id: "user-1",
|
||||
name: "홍길동",
|
||||
email: "hong@example.com",
|
||||
},
|
||||
{
|
||||
id: "user-2",
|
||||
name: "김영희",
|
||||
email: "",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("filters Hanmac family subtree and system tenants from non-family tenant choices", () => {
|
||||
const visibleTenants = filterNonHanmacFamilyTenants(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user