feat(ai-edit): 开发 AI 填报功能
This commit is contained in:
@@ -452,6 +452,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
},
|
||||
],
|
||||
purchase_cost_cny: '88.50',
|
||||
tags: [],
|
||||
description: null,
|
||||
physical_spec: {
|
||||
length_mm: null,
|
||||
width_mm: null,
|
||||
@@ -476,6 +478,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
source_sku: null,
|
||||
specification_values: [],
|
||||
purchase_cost_cny: '99.00',
|
||||
tags: [],
|
||||
description: null,
|
||||
physical_spec: {
|
||||
length_mm: null,
|
||||
width_mm: null,
|
||||
@@ -707,6 +711,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
source_sku: null,
|
||||
specification_values: [],
|
||||
purchase_cost_cny: '99.00',
|
||||
tags: [],
|
||||
description: null,
|
||||
physical_spec: {
|
||||
length_mm: null,
|
||||
width_mm: null,
|
||||
@@ -805,6 +811,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
]
|
||||
: variant.specification_values,
|
||||
purchase_cost_cny: variant.purchase_cost_cny,
|
||||
tags: variant.tags,
|
||||
description: variant.description,
|
||||
physical_spec:
|
||||
index === 0
|
||||
? {
|
||||
@@ -994,6 +1002,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
source_sku: variant.source_sku,
|
||||
specification_values: variant.specification_values,
|
||||
purchase_cost_cny: variant.purchase_cost_cny,
|
||||
tags: variant.tags,
|
||||
description: variant.description,
|
||||
physical_spec: variant.physical_spec,
|
||||
package_spec: variant.package_spec,
|
||||
offer_id: variant.listing.offer_id,
|
||||
@@ -1862,6 +1872,8 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
source_sku: item.source_sku,
|
||||
specification_values: item.specification_values,
|
||||
purchase_cost_cny: item.purchase_cost_cny,
|
||||
tags: item.tags,
|
||||
description: item.description,
|
||||
physical_spec: item.physical_spec,
|
||||
package_spec: item.package_spec,
|
||||
offer_id: item.listing.offer_id,
|
||||
@@ -1955,4 +1967,66 @@ describe('商品编辑 M3.0–M3.3 HTTP 集成测试', () => {
|
||||
'独立持久化后的采集商品描述',
|
||||
);
|
||||
});
|
||||
|
||||
it('俄文发布标题为空时发布就绪校验提示必填,填写后移除提示', async () => {
|
||||
await database.workspaceTransaction(workspaceId, async (tx) => {
|
||||
const store = await tx.query<{ id: string }>(
|
||||
`SELECT id FROM atlas.stores
|
||||
WHERE workspace_id = current_setting('app.workspace_id')::uuid
|
||||
AND platform_id = $1 AND is_default = true
|
||||
LIMIT 1`,
|
||||
[platformId],
|
||||
);
|
||||
if (!store.rows.length)
|
||||
await tx.query(
|
||||
`INSERT INTO atlas.stores
|
||||
(workspace_id, platform_id, name, platform_client_id,
|
||||
currency_code, is_default, status, credential_status)
|
||||
VALUES (current_setting('app.workspace_id')::uuid, $1,
|
||||
'俄文标题测试店铺', $2, 'RUB', true, 'active', 'valid')`,
|
||||
[platformId, `editor-title-${randomUUID()}`],
|
||||
);
|
||||
});
|
||||
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 profileId = entered.body.data.profile_id as string;
|
||||
const missing = await request(
|
||||
`/api/product-platform-profiles/${profileId}/validation`,
|
||||
{ headers: headers({ 'X-Atlas-Platform-Id': platformId }) },
|
||||
);
|
||||
assert.equal(missing.response.status, 200);
|
||||
assert.ok(
|
||||
missing.body.data.profile.issues.some(
|
||||
(issue: { code: string; field: string }) =>
|
||||
issue.code === 'PUBLISH_TITLE_REQUIRED' &&
|
||||
issue.field === 'profile.title',
|
||||
),
|
||||
);
|
||||
await database.workspaceTransaction(workspaceId, (tx) =>
|
||||
tx.query(
|
||||
`UPDATE atlas.product_platform_profiles SET title = $1 WHERE id = $2`,
|
||||
['Название товара', profileId],
|
||||
),
|
||||
);
|
||||
const filled = await request(
|
||||
`/api/product-platform-profiles/${profileId}/validation`,
|
||||
{ headers: headers({ 'X-Atlas-Platform-Id': platformId }) },
|
||||
);
|
||||
assert.equal(filled.response.status, 200);
|
||||
assert.ok(
|
||||
!filled.body.data.profile.issues.some(
|
||||
(issue: { code: string }) => issue.code === 'PUBLISH_TITLE_REQUIRED',
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user