1
0
forked from baron/baron-sso

테넌트 crud 테스트 코드 추가

This commit is contained in:
2026-02-27 11:28:39 +09:00
parent f02ba3cbbd
commit f97b989455
14 changed files with 221 additions and 53 deletions

View File

@@ -44,18 +44,18 @@ describe("tenantTree utility", () => {
it("calculates recursive member counts correctly", () => {
const { currentBase } = buildTenantFullTree(mockTenants, "root-1");
expect(currentBase).not.toBeNull();
if (currentBase) {
// Direct: 10, Child: 5, Grandchild: 2 -> Total: 17
expect(currentBase.recursiveMemberCount).toBe(17);
expect(currentBase.children).toHaveLength(1);
const child = currentBase.children[0];
// Direct: 5, Grandchild: 2 -> Total: 7
expect(child.recursiveMemberCount).toBe(7);
expect(child.children).toHaveLength(1);
const grandchild = child.children[0];
// Direct: 2 -> Total: 2
expect(grandchild.recursiveMemberCount).toBe(2);
@@ -84,10 +84,10 @@ describe("tenantTree utility", () => {
updatedAt: "",
},
];
const { subTree } = buildTenantFullTree(multiRootTenants);
expect(subTree).toHaveLength(2);
expect(subTree.map(n => n.id)).toContain("root-1");
expect(subTree.map(n => n.id)).toContain("root-2");
expect(subTree.map((n) => n.id)).toContain("root-1");
expect(subTree.map((n) => n.id)).toContain("root-2");
});
});