test: move demo-rebuild assertion to end of phase A (reseed invalidates earlier fixture)

This commit is contained in:
root
2026-10-17 15:11:50 +08:00
parent 216d18c843
commit f075f45b7c
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -116,6 +116,7 @@ const delInv = await api(A, 'GET', '/admin/invites', undefined, T);
const invRow = delInv.body?.data?.invites?.find((i) => i.code === delCode);
if (invRow) { await api(A, 'POST', '/admin/invites/delete', { id: invRow.id }, T); }
// 个人信息:upsert → get 往返
const profileContent = { info: { name: '张三', school: '重庆城市科技学院', major: '网络工程' }, resume: { selfIntro: '热爱安全研究' } };
const pUp = await api(A, 'POST', '/api/profile_upsert', { content: profileContent }, T);
@@ -164,6 +165,10 @@ ok((await api(A, 'POST', '/auth/register', { username: 'badcode', password: 'pas
const reseed = await api(A, 'POST', '/admin/demo-seed', undefined, T);
ok(reseed.body?.data?.seeded === false, '重复播种幂等跳过', reseed.body);
// demo 重建路由(管理员):重置 demo 数据为初始播种态
const re2 = await api(A, 'POST', '/admin/demo-rebuild', {}, T);
ok(re2.status === 200 && re2.body?.data?.seeded?.footprints === 16, 'demo 重建路由可达', re2.body);
// ---------- Phase B:同一数据目录「重启」(新模块实例 + 新端口) ----------
console.log('\n== Phase B:重启后(持久化 + 不重复播种) ==');
process.env.PORT = '8892';