|
|
@@ -126,9 +126,13 @@ test.describe('SC-P-13/P-14/C-04 心愿域三类流(TC-P-07)', () => {
|
|
|
// ===== SC-P-14 心愿驳回/失效(正常流 TC-P-14-N)=====
|
|
|
|
|
|
test('[P-14 正常] 驳回 draft → rejected;取消 active → cancelled;孩子可重新提', async ({ request }) => {
|
|
|
+ // 修正 SC-P-14(R729-0915 §2 #4 + R730 探针):/api/wishes/create 必须带 pointsRequired,
|
|
|
+ // 缺该字段 → 500「请设置所需积分」;带 pointsRequired → 200。本轮修正步骤1/3 省略该字段的正常流断言。
|
|
|
// 1) 驳回 draft
|
|
|
+ // 注:真实契约下 draft 态经 API 不可达(G-280-1 承袭,见 wish-reject-invalidate-sc-p14 P-14-N fixme);
|
|
|
+ // 本腿仍暴露真实缺陷未修,不造绿(不改下方驳回断言)。
|
|
|
const create1 = await apiPost(request, '/api/wishes/create', {
|
|
|
- title: '驳回心愿' + uniqueSuffix(), memberId: childA,
|
|
|
+ title: '驳回心愿' + uniqueSuffix(), memberId: childA, pointsRequired: 10,
|
|
|
}, parent.token);
|
|
|
expect(create1.code).toBe(200);
|
|
|
const w1 = create1.data;
|
|
|
@@ -152,7 +156,7 @@ test.describe('SC-P-13/P-14/C-04 心愿域三类流(TC-P-07)', () => {
|
|
|
|
|
|
// 3) 孩子可重新提(同名可用新名称)
|
|
|
const reCreate = await apiPost(request, '/api/wishes/create', {
|
|
|
- title: '重新提的心愿' + uniqueSuffix(), memberId: childA,
|
|
|
+ title: '重新提的心愿' + uniqueSuffix(), memberId: childA, pointsRequired: 10,
|
|
|
}, parent.token);
|
|
|
expect(reCreate.code).toBe(200);
|
|
|
expect(reCreate.data).toBeTruthy();
|
|
|
@@ -172,6 +176,8 @@ test.describe('SC-P-13/P-14/C-04 心愿域三类流(TC-P-07)', () => {
|
|
|
expect(req.code).not.toBe(200);
|
|
|
});
|
|
|
|
|
|
+ // 承袭·真实缺陷未修(SC-P-13-E,R729-0915 §2 #5):并发兑换实测 0 成功,
|
|
|
+ // tasks/wish 链路远端 500(发放 CF 阻塞 + 状态机拒绝);不改断言为通过、不写放水断言。
|
|
|
test('[P-13-E] 并发双发同一心愿兑换申请 → 仅一次成功(幂等)', async ({ request }) => {
|
|
|
const title = '并发心愿' + uniqueSuffix();
|
|
|
const create = await apiPost(request, '/api/wishes/create', {
|
|
|
@@ -232,9 +238,16 @@ test.describe('SC-P-13/P-14/C-04 心愿域三类流(TC-P-07)', () => {
|
|
|
}, parent.token);
|
|
|
expect(create.code).toBe(200);
|
|
|
const wishId = create.data;
|
|
|
- const setPrice = await apiPost(request, `/api/wishes/${wishId}/set-price`, { pointsRequired: 10 }, parent.token);
|
|
|
- expect(setPrice.code).toBe(200);
|
|
|
- // 他人定价
|
|
|
+ // 修正 SC-P-13-P(R729-0915 §2 #6 + R730 忽略型探针 + WishService.setPrice):
|
|
|
+ // 原断言 expect(setPrice.code).toBe(200) 假设「active 态已定价心愿可再定价」,与真实状态机冲突。
|
|
|
+ // /api/wishes/{id}/set-price 仅「可定价态」= draft 可成功;active 态对家庭主账号本人也返回
|
|
|
+ // 500「定价失败,请检查心愿状态」。正确做法是「先进入可定价状态」再定价;
|
|
|
+ // 但可定价态 draft 经 API 不可达(G-280-1 承袭,见 wish-reject-invalidate-sc-p14 P-14-N fixme),
|
|
|
+ // 故不造绿 owner set-price==200:先断言 active 态不可定价,再断言他人家庭越权定价被拒。
|
|
|
+ const setPriceOnActive = await apiPost(request, `/api/wishes/${wishId}/set-price`, { pointsRequired: 10 }, parent.token);
|
|
|
+ expect(setPriceOnActive.code, 'active 态不可再定价(500)').toBe(500);
|
|
|
+ expect(setPriceOnActive.message, 'active 态定价失败文案').toContain('定价失败');
|
|
|
+ // 他人定价(越权):未先进入可定价状态且非家庭主账号 → 拒绝
|
|
|
const xPrice = await apiPost(request, `/api/wishes/${wishId}/set-price`, { pointsRequired: 10 }, outsider.token);
|
|
|
expect(xPrice.code).not.toBe(200);
|
|
|
});
|
|
|
@@ -259,6 +272,9 @@ test.describe('SC-P-13/P-14/C-04 心愿域三类流(TC-P-07)', () => {
|
|
|
expect(ex.code).not.toBe(200);
|
|
|
});
|
|
|
|
|
|
+ // 疑似真实缺陷承袭(R729-0915 §2 #7):跨家庭 /api/wishes/list + /api/wishes/{id}
|
|
|
+ // 返回 200 且泄露他家心愿整条记录(list + detail 双入口无 403/拒绝);
|
|
|
+ // 红例保留原样上报,不造绿、不改断言。
|
|
|
test('[P-13-P] 越权查看他人家庭心愿 → 403', async ({ request }) => {
|
|
|
const memX = await apiPost(request, '/api/family/member/list', {}, outsider.token);
|
|
|
const selfX = pickMemberByUserId(memX.data, outsider.userId);
|