forked from baron/baron-sso
custom claim 타입보정 UI. 대표테넌트 노출 보정
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getSeedTenantSlugs, isSeedTenant } from "./protectedTenants";
|
||||
import { getSeedTenantIds, isSeedTenant } from "./protectedTenants";
|
||||
|
||||
describe("protectedTenants", () => {
|
||||
it("marks tenants from seed-tenant.csv as protected", () => {
|
||||
expect(getSeedTenantSlugs()).toEqual(
|
||||
expect.arrayContaining(["hanmac-family", "personal"]),
|
||||
it("marks tenants from seed-tenant.csv as protected by UUID", () => {
|
||||
expect(getSeedTenantIds()).toEqual(
|
||||
expect.arrayContaining([
|
||||
"038326b6-954a-48a7-a85f-efd83f62b82a",
|
||||
"5a03efd2-e62f-4243-800d-58334bf48b2f",
|
||||
"9607eb7b-04d2-42ab-80fe-780fe21c7e8f",
|
||||
]),
|
||||
);
|
||||
expect(isSeedTenant({ slug: "hanmac-family" })).toBe(true);
|
||||
expect(isSeedTenant({ slug: "normal-tenant" })).toBe(false);
|
||||
expect(
|
||||
isSeedTenant({
|
||||
id: "5a03efd2-e62f-4243-800d-58334bf48b2f",
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isSeedTenant({
|
||||
id: "5A03EFD2-E62F-4243-800D-58334BF48B2F",
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(isSeedTenant({ id: "normal-tenant" })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,16 +4,15 @@ import seedTenantCSVRaw from "../../../../seed-tenant.csv?raw";
|
||||
import type { TenantSummary } from "../../../lib/adminApi";
|
||||
import { parseTenantCSV } from "./tenantCsvImport";
|
||||
|
||||
const seedTenantSlugs = new Set(
|
||||
parseTenantCSV(seedTenantCSVRaw)
|
||||
.map((row) => row.slug.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
const seedTenants = parseTenantCSV(seedTenantCSVRaw);
|
||||
const seedTenantIds = new Set(
|
||||
seedTenants.map((row) => row.tenantId.trim().toLowerCase()).filter(Boolean),
|
||||
);
|
||||
|
||||
export function isSeedTenant(tenant: Pick<TenantSummary, "slug">): boolean {
|
||||
return seedTenantSlugs.has(tenant.slug.trim().toLowerCase());
|
||||
export function isSeedTenant(tenant: Pick<TenantSummary, "id">): boolean {
|
||||
return seedTenantIds.has(tenant.id.trim().toLowerCase());
|
||||
}
|
||||
|
||||
export function getSeedTenantSlugs(): string[] {
|
||||
return Array.from(seedTenantSlugs);
|
||||
export function getSeedTenantIds(): string[] {
|
||||
return Array.from(seedTenantIds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user