fix: profile_upsert payload binding

This commit is contained in:
root
2026-10-17 12:05:56 +08:00
parent 7331111379
commit 500d59ba58
4 changed files with 61 additions and 0 deletions
+10
View File
@@ -86,6 +86,16 @@ ok(tSet.body?.ok === true, 'attachment_set_thumb 回填缩略图', tSet.body);
const tGet = await api(A, 'POST', '/api/attachment_thumb', { id: rawUp.b?.data?.item?.id }, T);
ok(tGet.body?.data?.data_b64 === Buffer.from('RAWSUMB').toString('base64'), 'attachment_thumb 读回 raw 缩略图', tGet.body);
// 个人信息:upsert → get 往返
const profileContent = { info: { name: '张三', school: '重庆城市科技学院', major: '网络工程' }, resume: { selfIntro: '热爱安全研究' } };
const pUp = await api(A, 'POST', '/api/profile_upsert', { content: profileContent }, T);
ok(pUp.body?.ok === true, 'profile_upsert', pUp.body);
const pGet = await api(A, 'POST', '/api/profile_get', {}, T);
ok(pGet.body?.data?.content?.info?.name === '张三' && pGet.body?.data?.content?.resume?.selfIntro === '热爱安全研究', 'profile_get 往返一致', pGet.body);
const pUp2 = await api(A, 'POST', '/api/profile_upsert', { content: { ...profileContent, info: { ...profileContent.info, name: '李四' } } }, T);
const pGet2 = await api(A, 'POST', '/api/profile_get', {}, T);
ok(pGet2.body?.data?.content?.info?.name === '李四', 'profile 单行更新语义', pGet2.body);
// 删除整条记录 → 附件级联清理
const fpDel = await api(A, 'POST', '/api/footprint_delete', { id: fpId }, T);
ok(fpDel.body?.ok === true, '删除整条记录');