1
0
forked from baron/baron-sso

75f192fb24 기준 병합 code-check 수정

This commit is contained in:
2026-06-02 11:46:40 +09:00
parent 38605ac8a3
commit 2c5eed1774
17 changed files with 276 additions and 188 deletions

View File

@@ -31,9 +31,10 @@ vi.mock("react-oidc-context", () => ({
}));
vi.mock("react-router-dom", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>(
"react-router-dom",
);
const actual =
await vi.importActual<typeof import("react-router-dom")>(
"react-router-dom",
);
return {
...actual,
useNavigate: () => navigateMock,
@@ -175,7 +176,9 @@ describe("ClientsPage", () => {
});
const container = await renderPage();
expect(container.textContent).toContain("총 6개의 애플리케이션이 등록되어 있습니다.");
expect(container.textContent).toContain(
"총 6개의 애플리케이션이 등록되어 있습니다.",
);
expect(container.textContent).toContain("App 6");
expect(container.textContent).toContain("App 2");
expect(container.textContent).not.toContain("App 1");
@@ -192,26 +195,27 @@ describe("ClientsPage", () => {
expect(container.textContent).toContain("App 6");
expect(container.textContent).toContain("접기");
const advancedButton = Array.from(container.querySelectorAll("button")).find(
(button) => button.textContent === "Advanced Filters",
);
const advancedButton = Array.from(
container.querySelectorAll("button"),
).find((button) => button.textContent === "Advanced Filters");
expect(advancedButton).toBeTruthy();
await act(async () => {
advancedButton?.dispatchEvent(
new MouseEvent("click", { bubbles: true }),
);
advancedButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
const searchInput = Array.from(
container.querySelectorAll("input"),
).find((input) =>
input.getAttribute("placeholder")?.includes("클라이언트 이름/ID로 검색"),
const searchInput = Array.from(container.querySelectorAll("input")).find(
(input) =>
input
.getAttribute("placeholder")
?.includes("클라이언트 이름/ID로 검색"),
) as HTMLInputElement | undefined;
expect(searchInput).toBeTruthy();
if (!searchInput) {
throw new Error("Expected search input to be rendered");
}
await act(async () => {
await setInputValue(searchInput!, "missing-client");
await setInputValue(searchInput, "missing-client");
});
expect(container.textContent).toContain("조건에 맞는 연동 앱이 없습니다.");
@@ -226,7 +230,7 @@ describe("ClientsPage", () => {
});
await act(async () => {
await setInputValue(searchInput!, "");
await setInputValue(searchInput, "");
});
expect(container.textContent).toContain("App 1");

View File

@@ -532,10 +532,12 @@ function ClientsPage() {
t("ui.dev.clients.untitled", "Untitled")}
</p>
<p className="text-xs text-muted-foreground">
{t(
"ui.dev.clients.tenant_scoped",
"Tenant-scoped",
)}
<span aria-hidden="true">
{t(
"ui.dev.clients.tenant_scoped",
"Tenant-scoped",
)}
</span>
</p>
</div>
</Link>
@@ -615,14 +617,9 @@ function ClientsPage() {
"ui.dev.clients.list.collapse_aria",
"연동 앱 목록 접기",
)
: t(
"ui.dev.clients.list.more_aria",
"연동 앱 목록 더보기",
)
}
onClick={() =>
setIsClientListExpanded((current) => !current)
: t("ui.dev.clients.list.more_aria", "연동 앱 목록 더보기")
}
onClick={() => setIsClientListExpanded((current) => !current)}
>
{isClientListExpanded
? t("ui.common.collapse", "접기")

View File

@@ -8,7 +8,7 @@ vi.mock("../../../components/ui/avatar", () => ({
Avatar: ({ children }: { children: ReactNode }) => (
<div data-testid="avatar">{children}</div>
),
AvatarImage: (props: ComponentProps<"img">) => <img {...props} />,
AvatarImage: (props: ComponentProps<"img">) => <img alt="" {...props} />,
AvatarFallback: ({ children }: { children: ReactNode }) => (
<div data-testid="fallback">{children}</div>
),

View File

@@ -9,9 +9,10 @@ const listIdpConfigsMock = vi.fn();
const createIdpConfigMock = vi.fn();
vi.mock("react-router-dom", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>(
"react-router-dom",
);
const actual =
await vi.importActual<typeof import("react-router-dom")>(
"react-router-dom",
);
return {
...actual,
useParams: () => params,
@@ -19,10 +20,8 @@ vi.mock("react-router-dom", async () => {
});
vi.mock("../../../lib/devApi", () => ({
listIdpConfigsForClient: (clientId: string) =>
listIdpConfigsMock(clientId),
createIdpConfigForClient: (payload: unknown) =>
createIdpConfigMock(payload),
listIdpConfigsForClient: (clientId: string) => listIdpConfigsMock(clientId),
createIdpConfigForClient: (payload: unknown) => createIdpConfigMock(payload),
}));
vi.mock("../../../lib/i18n", () => ({
@@ -146,16 +145,15 @@ describe("ClientFederationPage", () => {
'input[name="oidc_client_secret"]',
) as HTMLInputElement | null;
expect(displayName).toBeTruthy();
expect(issuerUrl).toBeTruthy();
expect(clientId).toBeTruthy();
expect(clientSecret).toBeTruthy();
if (!displayName || !issuerUrl || !clientId || !clientSecret) {
throw new Error("Expected federation form inputs to be rendered");
}
await act(async () => {
await setInputValue(displayName!, "New Provider");
await setInputValue(issuerUrl!, "https://login.example");
await setInputValue(clientId!, "client-oidc");
await setInputValue(clientSecret!, "secret-value");
await setInputValue(displayName, "New Provider");
await setInputValue(issuerUrl, "https://login.example");
await setInputValue(clientId, "client-oidc");
await setInputValue(clientSecret, "secret-value");
});
const submitButton = Array.from(container.querySelectorAll("button")).find(