1
0
forked from baron/baron-sso

Merge remote-tracking branch 'origin/feature/df-claim-tenant' into dev

This commit is contained in:
2026-06-15 20:31:02 +09:00
17 changed files with 693 additions and 197 deletions

View File

@@ -65,6 +65,15 @@ test.describe("DevFront client tenant access settings", () => {
],
consents: [] as Consent[],
auditLogsByCursor: undefined,
myTenants: [
{
id: existingTenantId,
name: "Alpha Tenant",
slug: "alpha",
description: "Existing allowed tenant",
type: "organization",
},
],
tenants: [
{
id: existingTenantId,
@@ -99,10 +108,27 @@ test.describe("DevFront client tenant access settings", () => {
)
.toBe(existingTenantId);
await page
.getByPlaceholder(/테넌트 이름 또는 슬러그로 검색|tenant name or slug/i)
.fill("beta");
await page.getByRole("button", { name: /Beta Tenant/i }).click();
await page.getByRole("button", { name: /테넌트 선택기 열기/i }).click();
await page.evaluate(
(selection) => {
window.postMessage(
{
type: "orgfront:picker:confirm",
payload: {
selections: [
{
type: "tenant",
id: selection.id,
name: selection.name,
},
],
},
},
"*",
);
},
{ id: addedTenantId, name: "Beta Tenant" },
);
await expect(
page.getByTestId(`allowed-tenant-${addedTenantId}`),
).toContainText(addedTenantId);

View File

@@ -132,6 +132,7 @@ export type DevApiMockState = {
relations?: Record<string, ClientRelation[]>;
users?: DevAssignableUser[];
tenants?: DevTenantSummary[];
myTenants?: DevTenantSummary[];
auditLogsByCursor?: Record<
string,
{ items: AuditLog[]; next_cursor?: string }
@@ -437,6 +438,33 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
});
});
await page.route("**/api/v1/admin/tenants**", async (route) => {
const request = route.request();
const url = new URL(request.url());
const { searchParams } = url;
const tenants = state.tenants ?? [
{ id: "tenant-a", name: "Tenant A", slug: "tenant-a" },
];
return json(route, {
items: tenants.map((tenant) => ({
id: tenant.id,
name: tenant.name,
slug: tenant.slug,
description: tenant.description ?? "",
type: tenant.type ?? "organization",
parentId: null,
status: "active",
memberCount: 0,
createdAt: "2026-03-03T00:00:00.000Z",
updatedAt: "2026-03-03T00:00:00.000Z",
})),
limit: Number.parseInt(searchParams.get("limit") || "1000", 10),
offset: Number.parseInt(searchParams.get("offset") || "0", 10),
total: tenants.length,
});
});
await page.route("**/api/v1/dev/**", async (route) => {
const request = route.request();
const url = new URL(request.url());
@@ -534,9 +562,10 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
if (pathname === "/api/v1/dev/my-tenants" && method === "GET") {
return json(
route,
state.tenants ?? [
{ id: "tenant-a", name: "Tenant A", slug: "tenant-a" },
],
state.myTenants ??
state.tenants ?? [
{ id: "tenant-a", name: "Tenant A", slug: "tenant-a" },
],
);
}