1
0
forked from baron/baron-sso

Biome 및 Go 포맷 적용

This commit is contained in:
2026-03-04 09:44:12 +09:00
parent 0ad57ab69c
commit dc9332809b
5 changed files with 36 additions and 15 deletions

View File

@@ -171,6 +171,7 @@ func (m *AsyncMockTenantService) ListTenants(ctx context.Context, limit, offset
func (m *AsyncMockTenantService) ListManageableTenants(ctx context.Context, userID string) ([]domain.Tenant, error) { func (m *AsyncMockTenantService) ListManageableTenants(ctx context.Context, userID string) ([]domain.Tenant, error) {
return nil, nil return nil, nil
} }
func (m *AsyncMockTenantService) IsDomainAllowed(ctx context.Context, domainName string) (bool, error) { func (m *AsyncMockTenantService) IsDomainAllowed(ctx context.Context, domainName string) (bool, error) {
return false, nil return false, nil
} }

View File

@@ -27,16 +27,20 @@ func (m *devMockKetoService) CheckPermission(ctx context.Context, subject, names
args := m.Called(ctx, subject, namespace, object, relation) args := m.Called(ctx, subject, namespace, object, relation)
return args.Bool(0), args.Error(1) return args.Bool(0), args.Error(1)
} }
func (m *devMockKetoService) CreateRelation(ctx context.Context, ns, obj, rel, sub string) error { func (m *devMockKetoService) CreateRelation(ctx context.Context, ns, obj, rel, sub string) error {
return m.Called(ctx, ns, obj, rel, sub).Error(0) return m.Called(ctx, ns, obj, rel, sub).Error(0)
} }
func (m *devMockKetoService) DeleteRelation(ctx context.Context, ns, obj, rel, sub string) error { func (m *devMockKetoService) DeleteRelation(ctx context.Context, ns, obj, rel, sub string) error {
return m.Called(ctx, ns, obj, rel, sub).Error(0) return m.Called(ctx, ns, obj, rel, sub).Error(0)
} }
func (m *devMockKetoService) ListRelations(ctx context.Context, ns, obj, rel, sub string) ([]service.RelationTuple, error) { func (m *devMockKetoService) ListRelations(ctx context.Context, ns, obj, rel, sub string) ([]service.RelationTuple, error) {
args := m.Called(ctx, ns, obj, rel, sub) args := m.Called(ctx, ns, obj, rel, sub)
return args.Get(0).([]service.RelationTuple), args.Error(1) return args.Get(0).([]service.RelationTuple), args.Error(1)
} }
func (m *devMockKetoService) ListObjects(ctx context.Context, ns, rel, sub string) ([]string, error) { func (m *devMockKetoService) ListObjects(ctx context.Context, ns, rel, sub string) ([]string, error) {
args := m.Called(ctx, ns, rel, sub) args := m.Called(ctx, ns, rel, sub)
return args.Get(0).([]string), args.Error(1) return args.Get(0).([]string), args.Error(1)
@@ -53,6 +57,7 @@ func (m *devMockRedisRepo) Set(key, value string, exp time.Duration) error {
m.data[key] = value m.data[key] = value
return nil return nil
} }
func (m *devMockRedisRepo) Get(key string) (string, error) { func (m *devMockRedisRepo) Get(key string) (string, error) {
v, ok := m.data[key] v, ok := m.data[key]
if !ok { if !ok {
@@ -60,13 +65,14 @@ func (m *devMockRedisRepo) Get(key string) (string, error) {
} }
return v, nil return v, nil
} }
func (m *devMockRedisRepo) Delete(key string) error { func (m *devMockRedisRepo) Delete(key string) error {
delete(m.data, key) delete(m.data, key)
return nil return nil
} }
func (m *devMockRedisRepo) StoreVerificationCode(p, c string) error { return nil } func (m *devMockRedisRepo) StoreVerificationCode(p, c string) error { return nil }
func (m *devMockRedisRepo) GetVerificationCode(p string) (string, error) { return "", nil } func (m *devMockRedisRepo) GetVerificationCode(p string) (string, error) { return "", nil }
func (m *devMockRedisRepo) DeleteVerificationCode(p string) error { return nil } func (m *devMockRedisRepo) DeleteVerificationCode(p string) error { return nil }
type devEnhancedMockAuditRepo struct { type devEnhancedMockAuditRepo struct {
mockAuditRepo mockAuditRepo
@@ -77,6 +83,7 @@ type devEnhancedMockAuditRepo struct {
func (m *devEnhancedMockAuditRepo) CountFailuresSince(ctx context.Context, s time.Time, t string) (int64, error) { func (m *devEnhancedMockAuditRepo) CountFailuresSince(ctx context.Context, s time.Time, t string) (int64, error) {
return m.countFailures, nil return m.countFailures, nil
} }
func (m *devEnhancedMockAuditRepo) CountActiveSessionsSince(ctx context.Context, s time.Time, t string) (int64, error) { func (m *devEnhancedMockAuditRepo) CountActiveSessionsSince(ctx context.Context, s time.Time, t string) (int64, error) {
return m.countSessions, nil return m.countSessions, nil
} }

View File

@@ -1,10 +1,10 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { import {
type AuditLog,
type Consent,
installDevApiMock, installDevApiMock,
makeClient, makeClient,
seedAuth, seedAuth,
type AuditLog,
type Consent,
} from "./helpers/devfront-fixtures"; } from "./helpers/devfront-fixtures";
test.describe("DevFront audit logs", () => { test.describe("DevFront audit logs", () => {
@@ -85,7 +85,9 @@ test.describe("DevFront audit logs", () => {
await installDevApiMock(page, state); await installDevApiMock(page, state);
await page.goto("/clients/new"); await page.goto("/clients/new");
await page.getByPlaceholder("My Awesome Application").fill("Realtime New App"); await page
.getByPlaceholder("My Awesome Application")
.fill("Realtime New App");
await page await page
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i) .getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
.fill("https://realtime.example.com/callback"); .fill("https://realtime.example.com/callback");
@@ -93,7 +95,9 @@ test.describe("DevFront audit logs", () => {
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(1); await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(1);
await page.goto("/clients/client-realtime/settings"); await page.goto("/clients/client-realtime/settings");
await page.getByPlaceholder("My Awesome Application").fill("Realtime Updated"); await page
.getByPlaceholder("My Awesome Application")
.fill("Realtime Updated");
await page.getByRole("button", { name: /^저장$|^Save$/i }).click(); await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(2); await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(2);

View File

@@ -1,10 +1,10 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { import {
type ClientStatus,
type Consent,
installDevApiMock, installDevApiMock,
makeClient, makeClient,
seedAuth, seedAuth,
type ClientStatus,
type Consent,
} from "./helpers/devfront-fixtures"; } from "./helpers/devfront-fixtures";
test.describe("DevFront clients lifecycle", () => { test.describe("DevFront clients lifecycle", () => {
@@ -109,9 +109,9 @@ test.describe("DevFront clients lifecycle", () => {
.getByRole("button", { name: /Redirect URIs 저장|Save/i }) .getByRole("button", { name: /Redirect URIs 저장|Save/i })
.click(); .click();
await expect.poll(() => state.clients[0]?.redirectUris[0]).toBe( await expect
"https://after.example.com/callback", .poll(() => state.clients[0]?.redirectUris[0])
); .toBe("https://after.example.com/callback");
await page.reload(); await page.reload();
await expect( await expect(

View File

@@ -43,13 +43,19 @@ export type AuditLog = {
export type DevApiMockState = { export type DevApiMockState = {
clients: Client[]; clients: Client[];
consents: Consent[]; consents: Consent[];
auditLogsByCursor?: Record<string, { items: AuditLog[]; next_cursor?: string }>; auditLogsByCursor?: Record<
string,
{ items: AuditLog[]; next_cursor?: string }
>;
auditLogs?: AuditLog[]; auditLogs?: AuditLog[];
onUpdateStatus?: (status: ClientStatus) => void; onUpdateStatus?: (status: ClientStatus) => void;
onRotateSecret?: (newSecret: string) => void; onRotateSecret?: (newSecret: string) => void;
}; };
export function makeClient(id: string, overrides: Partial<Client> = {}): Client { export function makeClient(
id: string,
overrides: Partial<Client> = {},
): Client {
return { return {
id, id,
name: `${id} app`, name: `${id} app`,
@@ -301,7 +307,9 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
const status = searchParams.get("status") || ""; const status = searchParams.get("status") || "";
const items = state.consents.filter((row) => { const items = state.consents.filter((row) => {
const matchesSubject = const matchesSubject =
!subject || row.subject.includes(subject) || row.userName.includes(subject); !subject ||
row.subject.includes(subject) ||
row.userName.includes(subject);
const matchesClientId = !clientId || row.clientId === clientId; const matchesClientId = !clientId || row.clientId === clientId;
const matchesStatus = !status || row.status === status; const matchesStatus = !status || row.status === status;
return matchesSubject && matchesClientId && matchesStatus; return matchesSubject && matchesClientId && matchesStatus;
@@ -347,7 +355,8 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
}; };
} catch {} } catch {}
const matchesAction = !action || parsedDetails.action === action; const matchesAction = !action || parsedDetails.action === action;
const matchesClient = !clientId || parsedDetails.target_id === clientId; const matchesClient =
!clientId || parsedDetails.target_id === clientId;
const matchesStatus = !status || item.status === status; const matchesStatus = !status || item.status === status;
return matchesAction && matchesClient && matchesStatus; return matchesAction && matchesClient && matchesStatus;
}); });