feat(edit): 采集插件、编辑页SKU 属性动态展示、颜色展示开发
This commit is contained in:
@@ -1844,4 +1844,70 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
[asset],
|
||||
);
|
||||
});
|
||||
|
||||
it('独立保存采集描述会持久化覆盖值并保持幂等', async () => {
|
||||
const created = await createCollectionItem('独立保存描述测试商品');
|
||||
const entered = await request(
|
||||
`/api/collection-items/${created.collectionItemId}/editor-contexts`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers({
|
||||
'X-Atlas-Platform-Id': platformId,
|
||||
'Idempotency-Key': randomUUID(),
|
||||
}),
|
||||
},
|
||||
);
|
||||
assert.equal(entered.response.status, 201);
|
||||
const before = await request(`/api/products/${created.productId}/editor`, {
|
||||
headers: headers({ 'X-Atlas-Platform-Id': platformId }),
|
||||
});
|
||||
const key = randomUUID();
|
||||
const body = {
|
||||
description: '独立持久化后的采集商品描述',
|
||||
source_snapshot_revision:
|
||||
before.body.data.source_material.source_snapshot_revision,
|
||||
};
|
||||
const saved = await request(
|
||||
`/api/products/${created.productId}/source-description`,
|
||||
{
|
||||
method: 'PUT',
|
||||
headers: headers({
|
||||
'X-Atlas-Platform-Id': platformId,
|
||||
'Idempotency-Key': key,
|
||||
'If-Match': `"${before.body.data.product.revision}:${before.body.data.profile.revision}"`,
|
||||
}),
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
assert.equal(saved.response.status, 200);
|
||||
assert.equal(
|
||||
saved.body.data.source_material.description,
|
||||
'独立持久化后的采集商品描述',
|
||||
);
|
||||
assert.ok(
|
||||
saved.body.data.source_material_state.overridden_fields.includes(
|
||||
'description',
|
||||
),
|
||||
);
|
||||
const replay = await request(
|
||||
`/api/products/${created.productId}/source-description`,
|
||||
{
|
||||
method: 'PUT',
|
||||
headers: headers({
|
||||
'X-Atlas-Platform-Id': platformId,
|
||||
'Idempotency-Key': key,
|
||||
'If-Match': `"${before.body.data.product.revision}:${before.body.data.profile.revision}"`,
|
||||
}),
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
assert.deepEqual(replay.body, saved.body);
|
||||
const after = await request(`/api/products/${created.productId}/editor`, {
|
||||
headers: headers({ 'X-Atlas-Platform-Id': platformId }),
|
||||
});
|
||||
assert.equal(
|
||||
after.body.data.source_material.description,
|
||||
'独立持久化后的采集商品描述',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user