fix(15): convert auth service/tests to async PGlite pattern

The executor agents wrote sync SQLite-style calls (.get(), .all(), .run())
instead of the async Postgres pattern established in Phase 14. Fixed:
- auth.service.ts: use await + destructuring for all DB operations
- auth routes: await listApiKeys
- All auth test files: async createTestDb(), await service calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 21:40:12 +02:00
parent 72eefd1a06
commit 59e7f4be8a
5 changed files with 22 additions and 25 deletions

View File

@@ -20,8 +20,8 @@ mock.module("../../src/server/services/oauth.service", () => ({
// Import routes AFTER mocks
const { authRoutes } = await import("../../src/server/routes/auth.ts");
function createTestApp() {
const db = createTestDb();
async function createTestApp() {
const db = await createTestDb();
const app = new Hono<{ Variables: { db?: any } }>();
app.use("*", async (c, next) => {
@@ -35,10 +35,10 @@ function createTestApp() {
describe("Auth Routes", () => {
let app: Hono;
let db: ReturnType<typeof createTestDb>;
let db: Awaited<ReturnType<typeof createTestDb>>;
beforeEach(() => {
const testApp = createTestApp();
beforeEach(async () => {
const testApp = await createTestApp();
app = testApp.app;
db = testApp.db;
mockGetAuth.mockReset();