Files
ssw-mvp/docs/e2e/cases/TC-TRADE-010.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

72 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-TRADE-010 · 条件不满足时不能办理交易订单
* REQ-022 [FL-17.2] 反向/状态迁移 P0
*
* 前置:1. 服务平台的【数据交易】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开服务平台的【数据交易】
* 2. 使用无权限账号或错误数据办理交易订单
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理交易订单,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-TRADE-010',
req: 'REQ-022',
title: '条件不满足时不能办理交易订单',
type: '反向/状态迁移',
priority: 'P0',
route: '/tds/market',
needs: ['fe', 'be']
}
export async function run(t) {
let before = 0
await t.step('前置:登录并记录订单当前条数', async () => {
await t.login()
await t.goto('/tds/market')
before = (await t.apiList('/api/ssw/tdc/Order')).length
t.assert(true, `提交前订单共 ${before} 条`)
})
await t.step('使用不存在的 productId 登记订单应被拒', async () => {
const r = await t.api('POST', '/api/ssw/tdc/Order', {
orderCode: `ORD-BAD-${t.runId}`,
productId: 'non-exist-product-id-xxxx',
quantity: 1
})
t.assert(r.code !== 200, `不存在的 productId 应被拒(实际 code=${r.code})`)
t.assert(/不存在|数据资源|错误|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('对不存在的订单调 Approve 应被拒', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Order/non-exist-order-id/Approve', { opinion: '测试' })
t.assert(r.code !== 200, `不存在的 ID 审核被拒(实际 code=${r.code})`)
})
await t.step('对非 PENDING 状态的订单调 Approve 应被拒(状态机不允许)', async () => {
const list = await t.apiList('/api/ssw/tdc/Order', { pageSize: 50 })
const nonPending = list.find((r) => r.status && r.status !== 'PENDING')
if (!nonPending) t.skip('库里没有非 PENDING 的订单,跳过本步')
const r = await t.api('PUT', `/api/ssw/tdc/Order/${nonPending.id}/Approve`, { opinion: '测试' })
t.assert(r.code !== 200, `非 PENDING 审核被拒(实际 code=${r.code})`)
t.assert(/状态|不允许|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('对非 APPROVED 状态的订单调 ConfirmPayment 应被拒', async () => {
const list = await t.apiList('/api/ssw/tdc/Order', { pageSize: 50 })
const nonApproved = list.find((r) => r.status && r.status !== 'APPROVED' && r.status !== 'CONFIRMING')
if (!nonApproved) t.skip('库里没有非 APPROVED 的订单,跳过本步')
const r = await t.api('PUT', `/api/ssw/tdc/Order/${nonApproved.id}/ConfirmPayment`)
t.assert(r.code !== 200, `非 APPROVED 付款被拒(实际 code=${r.code})`)
t.assert(/审核|状态|未通过|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('核对原有数据和状态不变', async () => {
const after = (await t.apiList('/api/ssw/tdc/Order')).length
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
await t.expectNoRow(`ORD-BAD-${t.runId}`)
})
t.expectConsoleClean()
}