This commit is contained in:
浅念
2026-08-27 16:11:49 +08:00
commit 2d8ef3d7bb
104 changed files with 20196 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import { describe, it, expect } from 'vitest';
import request from 'supertest';
import { createApp } from '../src/app.js';
describe('health', () => {
it('ok (200 if DB reachable, 503 if not — both acceptable, never 500)', async () => {
const res = await request(createApp()).get('/api/health');
// 单元环境无容器连不上 → 503;有容器 → 200。两者都算通过(只杜绝 500 崩)
expect([200, 503]).toContain(res.status);
expect(res.body).toHaveProperty('ok');
});
});