1
0
forked from baron/baron-sso

feat: integrate orgfront and expose internal ids

This commit is contained in:
2026-04-30 09:33:39 +09:00
parent 02375af08d
commit 9ce7a67f58
116 changed files with 22992 additions and 33 deletions

View File

@@ -1,13 +1,15 @@
import { describe, expect, it } from "vitest";
import {
buildAuthenticatedOrgChartTenantPickerUrl,
buildAuthenticatedOrgChartUrl,
buildOrgChartTenantPickerUrl,
filterNonHanmacFamilyTenants,
isHanmacFamilyUser,
parseOrgChartTenantSelection,
} from "./orgChartPicker";
describe("orgChartPicker", () => {
it("builds the tenant picker embed URL from VITE_ORGCHART_URL", () => {
it("builds the tenant picker embed URL from ORGFRONT_URL", () => {
expect(buildOrgChartTenantPickerUrl("https://orgchart.example.com/")).toBe(
"https://orgchart.example.com/embed/picker?mode=single&select=tenant&width=400&height=600",
);
@@ -36,6 +38,12 @@ describe("orgChartPicker", () => {
);
});
it("builds the chart navigation URL through the org-chart auto login entry", () => {
expect(buildAuthenticatedOrgChartUrl("https://orgchart.example.com/")).toBe(
"https://orgchart.example.com/login?auto=1&returnTo=%2Fchart",
);
});
it("parses the first tenant id and name from orgfront confirm messages", () => {
expect(
parseOrgChartTenantSelection({
@@ -115,4 +123,50 @@ describe("orgChartPicker", () => {
expect(visibleTenants.map((tenant) => tenant.slug)).toEqual(["external"]);
});
it("detects existing users as Hanmac family from tenant subtree without metadata flag", () => {
const tenants = [
{
id: "external-id",
slug: "external",
name: "External",
type: "COMPANY",
parentId: undefined,
},
{
id: "hanmac-family-id",
slug: "hanmac-family",
name: "한맥가족",
type: "COMPANY_GROUP",
parentId: undefined,
},
{
id: "hanmac-company-id",
slug: "hanmac-company",
name: "한맥기술",
type: "COMPANY",
parentId: "hanmac-family-id",
},
{
id: "hanmac-team-id",
slug: "hanmac-team",
name: "기술기획",
type: "USER_GROUP",
parentId: "hanmac-company-id",
},
];
expect(
isHanmacFamilyUser(
{
companyCode: "external",
tenant: tenants[0],
joinedTenants: [tenants[3]],
metadata: {},
},
tenants,
"hanmac-family-id",
),
).toBe(true);
});
});