import test from 'node:test'; import assert from 'node:assert/strict'; import request from 'supertest'; import app from '../src/app.js'; test('GET /health 返回 200', async () => { const res = await request(app).get('/health'); assert.equal(res.status, 200); assert.equal(res.body.ok, true); }); test('POST /api/users 参数缺失返回 422', async () => { const res = await request(app).post('/api/users').send({ name: '' }); assert.equal(res.status, 422); assert.ok(res.body.details.length > 0); });