清理履约假草稿商品残留关联
This commit is contained in:
@@ -281,6 +281,30 @@ test(
|
||||
finalFulfillments.rows.every((row) => row.issue_code === '' && row.pending_reason === null),
|
||||
)
|
||||
|
||||
const invalidDraftProduct = await query<{ id: number }>(
|
||||
`INSERT INTO product_catalog (
|
||||
canonical_sku, canonical_name, category, unit_name, source_kind, status,
|
||||
attributes_json, created_at, updated_at
|
||||
) VALUES (
|
||||
$1, '历史假草稿商品', '接单测试', '件', 'work_order', 'archived',
|
||||
'{"draft":true}'::jsonb, NOW(), NOW()
|
||||
) RETURNING id`,
|
||||
[`tpl:invalid-${suffix}`],
|
||||
)
|
||||
const invalidDraftProductId = Number(invalidDraftProduct.rows[0]!.id)
|
||||
productIds.push(invalidDraftProductId)
|
||||
await assert.rejects(
|
||||
() =>
|
||||
query(
|
||||
`UPDATE fulfillments
|
||||
SET canonical_product_id = $2,
|
||||
updated_at = NOW()
|
||||
WHERE order_item_id = $1`,
|
||||
[orderItemIds[0], invalidDraftProductId],
|
||||
),
|
||||
/invalid work-order draft product/,
|
||||
)
|
||||
|
||||
await assert.rejects(
|
||||
() =>
|
||||
query(
|
||||
|
||||
Reference in New Issue
Block a user