style(13-03): apply Prettier formatting across repo
Mechanical reformat — no logic changes. 398 files changed, 19125 insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* - GET /health returns 503 if the DB round-trip throws
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
// vi.mock is hoisted to the top of the module by Vitest — defining it here is correct.
|
||||
// The factory is called before any test runs.
|
||||
@@ -14,25 +14,25 @@ vi.mock('../src/db/client.js', () => ({
|
||||
db: {
|
||||
execute: vi.fn().mockResolvedValue([[{ '1': 1 }]]),
|
||||
},
|
||||
}))
|
||||
}));
|
||||
|
||||
describe('GET /health', () => {
|
||||
it('returns 200 with { ok: true, db: "up" } when DB round-trip succeeds', async () => {
|
||||
const { app } = await import('../src/index.js')
|
||||
const res = await app.request('/health')
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json() as { ok: boolean; db: string }
|
||||
expect(body.ok).toBe(true)
|
||||
expect(body.db).toBe('up')
|
||||
})
|
||||
const { app } = await import('../src/index.js');
|
||||
const res = await app.request('/health');
|
||||
expect(res.status).toBe(200);
|
||||
const body = (await res.json()) as { ok: boolean; db: string };
|
||||
expect(body.ok).toBe(true);
|
||||
expect(body.db).toBe('up');
|
||||
});
|
||||
|
||||
it('returns 503 when DB round-trip throws', async () => {
|
||||
const { db } = await import('../src/db/client.js')
|
||||
const { db } = await import('../src/db/client.js');
|
||||
// Temporarily override execute to throw
|
||||
vi.mocked(db.execute).mockRejectedValueOnce(new Error('DB connection failed'))
|
||||
vi.mocked(db.execute).mockRejectedValueOnce(new Error('DB connection failed'));
|
||||
|
||||
const { app } = await import('../src/index.js')
|
||||
const res = await app.request('/health')
|
||||
expect(res.status).toBe(503)
|
||||
})
|
||||
})
|
||||
const { app } = await import('../src/index.js');
|
||||
const res = await app.request('/health');
|
||||
expect(res.status).toBe(503);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user