forked from baron/baron-sso
테넌트 crud 테스트 코드 추가
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user