Files
ssw-mvp/docs/e2e/cases/TC-TRADE-007.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

71 lines
3.0 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-007 · 条件不满足时不能办理计量计费
* REQ-021 [FL-17.1] 反向/状态迁移 P0
*
* 前置:1. 服务平台的【数据交易】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开服务平台的【数据交易】
* 2. 使用无权限账号或错误数据办理计量计费
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理计量计费,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-TRADE-007',
req: 'REQ-021',
title: '条件不满足时不能办理计量计费',
type: '反向/状态迁移',
priority: 'P0',
route: '/tds/billing',
needs: ['fe', 'be']
}
export async function run(t) {
let before = 0
await t.step('前置:登录并记录计费台账当前条数', async () => {
await t.login()
await t.goto('/tds/billing')
before = (await t.apiList('/api/ssw/tds/BillingLedger')).length
t.assert(true, `提交前台账共 ${before} 条`)
})
await t.step('缺必填项提交:不填「产品」字段', async () => {
await t.openCreate()
await t.fillForm({
用量: 3,
单价: 0.5
})
await t.save()
await t.expectReject('不能为空')
await t.shot('产品必填校验')
t.assert(await t.drawer().isVisible(), '校验未通过时抽屉保持打开,未误提交')
await t.cancelDrawer()
})
await t.step('对不存在的台账调 Settle 应被拒绝', async () => {
const r = await t.api('POST', '/api/ssw/tds/BillingLedger/Settle', {
ledgerIds: ['non-exist-id-xxxx']
})
t.assert(r.code === 200, `空 ID 集合结算接口返回 200(实际 code=${r.code})`)
// 后端实现:ledgerIds 不存在时静默跳过,返回 0 —— 文档/语义上仍属「无效输入未生效」
t.assert(r.data === 0, `空 ID 集合结算返回 0 条(实际 ${r.data})`)
})
await t.step('对已结算(SETTLED)的台账再点「结算」应被拒(状态机不允许)', async () => {
const list = await t.apiList('/api/ssw/tds/BillingLedger', { pageSize: 50 })
const settled = list.find((r) => r.status === 'SETTLED' || r.status === 'INVOICED')
if (!settled) t.skip('库里没有已结算的台账,跳过本步')
const r = await t.api('POST', '/api/ssw/tds/BillingLedger/Settle', { ledgerIds: [settled.id] })
t.assert(r.code === 200, `接口本身仍返回 200(实际 code=${r.code})`)
// 后端语义:已 SETTLED/INVOICED 的台账再次结算会被静默跳过
const after = (await t.apiList('/api/ssw/tds/BillingLedger', { keyword: settled.productName })).find((r) => r.id === settled.id)
t.assert(after.status === settled.status, `二次结算不改变状态(${settled.status})`)
})
await t.step('核对原有数据和状态不变', async () => {
const after = (await t.apiList('/api/ssw/tds/BillingLedger')).length
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
})
t.expectConsoleClean()
}