1
0
forked from baron/baron-sso

chore: fix formatting and lint errors across Makefile, backend, and adminfront

This commit addresses several linting and formatting issues that caused CI checks to fail:
- Makefile: Removed obsolete '--organize-imports-enabled' from Biome and switched to '@biomejs/biome'.
- backend: Fixed spacing and alignment issues according to gofmt.
- adminfront: Fixed multiple unused variables and imports, and configured unsafe fixes in the Biome config to remove dead code.
This commit is contained in:
2026-05-29 15:31:30 +09:00
parent b33aabbb68
commit 2da470922b
27 changed files with 124 additions and 147 deletions

View File

@@ -32,7 +32,7 @@ test.describe("Audit Logs Management", () => {
headers: { "Access-Control-Allow-Origin": "*" },
});
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
@@ -67,19 +67,21 @@ test.describe("Audit Logs Management", () => {
});
await page.goto("/audit-logs");
// Check header
await expect(page.getByText(/감사 로그|Audit Logs/i).first()).toBeVisible();
// Check if table rows are rendered
await expect(page.locator("tbody tr")).toHaveCount(20);
// Check specific data visible in the row
await expect(page.locator("tbody")).toContainText("user-even");
await expect(page.locator("tbody")).toContainText("CREATE_TENANT");
});
test("should load more logs on scroll (infinite scroll)", async ({ page }) => {
test("should load more logs on scroll (infinite scroll)", async ({
page,
}) => {
let callCount = 0;
await page.route("**/api/v1/audit?limit=50*", async (route) => {
const logs = generateMockLogs(20, callCount * 20);
@@ -93,10 +95,12 @@ test.describe("Audit Logs Management", () => {
await page.goto("/audit-logs");
await expect(page.locator("tbody tr")).toHaveCount(20);
const loadMoreBtn = page.getByRole('button', { name: /더 보기|Load more/i });
const loadMoreBtn = page.getByRole("button", {
name: /더 보기|Load more/i,
});
await expect(loadMoreBtn).toBeVisible();
await loadMoreBtn.click();
// Wait for the next page to load
await expect(page.locator("tbody tr")).toHaveCount(40);
// user-even and CREATE_TENANT should still be visible in the newly loaded rows
@@ -118,10 +122,10 @@ test.describe("Audit Logs Management", () => {
// Search by User ID
const userIdInput = page.getByTestId("audit-search-user-id");
await userIdInput.fill("user-even");
// Wait for deferred value to apply
await page.waitForTimeout(500);
// Half of 20 logs are user-even
await expect(page.locator("tbody tr")).toHaveCount(10);
await expect(page.locator("tbody")).not.toContainText("user-odd");
@@ -135,7 +139,7 @@ test.describe("Audit Logs Management", () => {
const actionInput = page.getByTestId("audit-search-action");
await actionInput.fill("ROTATE_SECRET");
await page.waitForTimeout(500);
// Check that we only see ROTATE_SECRET (20 - 7 = 13)
await expect(page.locator("tbody tr")).toHaveCount(13);
await expect(page.locator("tbody")).not.toContainText("CREATE_TENANT");
@@ -158,11 +162,11 @@ test.describe("Audit Logs Management", () => {
// ID % 5 === 0 are status "failure"
// IDs: 0, 5, 10, 15 => 4 items
await expect(page.locator("tbody tr")).toHaveCount(4);
// Select "Success" status
await page.getByTestId("audit-filter-status").selectOption("success");
// IDs: 1,2,3,4, 6,7,8,9, 11,12,13,14, 16,17,18,19 => 16 items
await expect(page.locator("tbody tr")).toHaveCount(16);
});
});
});

View File

@@ -258,7 +258,7 @@ test.describe("Tenants Management", () => {
page,
}) => {
await page.setViewportSize({ width: 900, height: 700 });
let requestCount = 0;
let _requestCount = 0;
await page.route("**/api/v1/admin/tenants**", async (route) => {
if (route.request().method() !== "GET") {
@@ -266,7 +266,7 @@ test.describe("Tenants Management", () => {
}
const url = new URL(route.request().url());
const cursor = url.searchParams.get("cursor");
requestCount += 1;
_requestCount += 1;
if (!cursor) {
return route.fulfill({

View File

@@ -5,7 +5,9 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
await page.addInitScript(() => {
window.localStorage.setItem("locale", "ko");
window.localStorage.setItem("admin_session", "fake-token");
(window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean })._IS_TEST_MODE = true;
(
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authData = {
access_token: "fake-token",
@@ -13,12 +15,20 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
profile: { sub: "admin-user", name: "Admin", role: "super_admin" },
expires_at: Math.floor(Date.now() / 1000) + 36000,
};
window.localStorage.setItem("oidc.user:http://localhost:5000/oidc:adminfront", JSON.stringify(authData));
window.localStorage.setItem(
"oidc.user:http://localhost:5000/oidc:adminfront",
JSON.stringify(authData),
);
});
await page.route("**/api/v1/user/me", async (route) => {
return route.fulfill({
json: { id: "admin-user", name: "Admin", role: "super_admin", manageableTenants: [] },
json: {
id: "admin-user",
name: "Admin",
role: "super_admin",
manageableTenants: [],
},
headers: { "Access-Control-Allow-Origin": "*" },
});
});
@@ -31,7 +41,7 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
});
await page.route("**/api/v1/admin/users*", async (route) => {
if(route.request().url().includes("/bulk")) {
if (route.request().url().includes("/bulk")) {
return route.continue();
}
return route.fulfill({
@@ -45,14 +55,20 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
});
});
test("should parse secondary_emails and send to backend", async ({ page }) => {
let bulkPayload: any = null;
test("should parse secondary_emails and send to backend", async ({
page,
}) => {
let bulkPayload: Record<string, unknown> | null = null;
await page.route("**/api/v1/admin/users/bulk", async (route) => {
if (route.request().method() === "POST") {
bulkPayload = route.request().postDataJSON();
bulkPayload = route.request().postDataJSON() as Record<string, unknown>;
return route.fulfill({
json: { results: [{ email: "test@example.com", success: true, userId: "u-1" }] },
json: {
results: [
{ email: "test@example.com", success: true, userId: "u-1" },
],
},
headers: { "Access-Control-Allow-Origin": "*" },
});
}
@@ -60,21 +76,26 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
});
await page.goto("/users");
await expect(page.getByTestId("page-title")).toContainText(/사용자|Users/i, { timeout: 20000 });
await expect(page.getByTestId("page-title")).toContainText(
/사용자|Users/i,
{ timeout: 20000 },
);
await page.getByTestId("user-data-mgmt-btn").click();
await page.getByRole("menuitem", { name: /일괄 임포트|일괄 등록|Bulk Import/i }).click();
await page
.getByRole("menuitem", { name: /일괄 임포트|일괄 등록|Bulk Import/i })
.click();
// Create a mock CSV with secondary_emails
const csvContent = `email,sub_email,name,phone,role,tenant_slug\ntest@example.com,sub1@test.com;sub2@test.com,홍길동,010-1234-5678,user,tenant-slug`;
const fileChooserPromise = page.waitForEvent('filechooser');
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByText(/파일 선택|Change file|Select file/i).click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles({
name: 'users_with_secondary.csv',
mimeType: 'text/csv',
name: "users_with_secondary.csv",
mimeType: "text/csv",
buffer: Buffer.from(csvContent),
});
@@ -86,10 +107,14 @@ test.describe("Users Bulk Upload Secondary Emails", () => {
await expect(page.getByText(/성공|Success/i)).toBeVisible();
expect(bulkPayload).not.toBeNull();
expect(bulkPayload.users).toHaveLength(1);
const payloadUsers = bulkPayload?.users as Array<{
metadata: { sub_email: string[] };
}>;
expect(payloadUsers).toHaveLength(1);
// The most important check - does it parse to the metadata
expect(bulkPayload.users[0].metadata.sub_email).toContain("sub1@test.com");
expect(bulkPayload.users[0].metadata.sub_email).toContain("sub2@test.com");
expect(payloadUsers[0].metadata.sub_email).toContain("sub1@test.com");
expect(payloadUsers[0].metadata.sub_email).toContain("sub2@test.com");
});
});
});