- 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
77 lines
3.6 KiB
JavaScript
77 lines
3.6 KiB
JavaScript
/**
|
||
* TC-DELIVERY_API-001 · 正常办理数据传输
|
||
* REQ-066 数据传输 / FL 12.2 正向/场景法 P0
|
||
*
|
||
* 前置:1. 已绑定连接器的机构用户或已认证连接器
|
||
* 2. 通过已认证的调用方连接器调用"数据传输"接口可以正常打开
|
||
* 3. 已准备好测试数据
|
||
* 步骤:1. 打开通过已认证的调用方连接器调用"数据传输"接口
|
||
* 2. 按页面提示填写或选择正确的数据
|
||
* 3. 点击提交,查看办理结果
|
||
* 预期:数据传输办理成功,系统按要求完成处理,状态和记录正确。
|
||
*
|
||
* 说明:本用例为纯接口级验证。数据传输入口为 /api/ssw/tdc/Gateway/Invoke,
|
||
* 按三件套 (appId, appKey, xOrderCode) 鉴权与策略执行。
|
||
* 后端对每次调用都会在 tdc_api_consume_log 落痕。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-DELIVERY_API-001',
|
||
req: 'REQ-066',
|
||
title: '正常办理数据传输',
|
||
type: '正向/场景法',
|
||
priority: 'P0',
|
||
route: '',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let target = null
|
||
let expectAppId = null
|
||
|
||
await t.step('前置:登录', async () => {
|
||
await t.login()
|
||
})
|
||
|
||
await t.step('前置:选一条 deliveryType=API 且有 taskCode 的任务', async () => {
|
||
const r = await fetch('http://localhost:30000/api/ssw/tdc/DeliveryTask?currentPage=1&pageSize=20&deliveryType=API', {
|
||
headers: { Authorization: t.token, 'App-Code': 'sswflow', 'Jnpf-Origin': 'pc', 'Vue-Version': '3' }
|
||
})
|
||
const j = await r.json()
|
||
target = (j.data?.list || []).find((x) => x.taskCode && x.productId)
|
||
if (!target) t.skip('库中没有可调用的 API 交付任务')
|
||
expectAppId = 'app_' + target.id.substring(0, Math.min(8, target.id.length))
|
||
t.assert(true, `选定 ${target.taskCode} expectAppId=${expectAppId}`)
|
||
})
|
||
|
||
await t.step('正向 1:POST /Gateway/Invoke 鉴权通过 + 返回骨架数据', async () => {
|
||
const r = await t.api('POST', '/api/ssw/tdc/Gateway/Invoke', {
|
||
appId: expectAppId,
|
||
appKey: 'e2e-appkey-' + t.runId,
|
||
xOrderCode: target.taskCode
|
||
})
|
||
t.assert(r.code === 200, `Invoke 200(${r.code})`)
|
||
t.assert(r.data?.xOrderCode === target.taskCode, `回执 xOrderCode 一致`)
|
||
t.assert(Array.isArray(r.data?.rows), `返回了 rows`)
|
||
t.assert(typeof r.data?.total === 'number', `返回了 total(${r.data?.total})`)
|
||
t.assert(typeof r.data?.callCount === 'number', `返回了 callCount(${r.data?.callCount})`)
|
||
})
|
||
|
||
await t.step('正向 2:消费日志已落库', async () => {
|
||
const r = await t.api('GET', `/api/ssw/tdc/ApiConsumeLog?currentPage=1&pageSize=10&orderCode=${encodeURIComponent(target.taskCode)}&status=SUCCESS`)
|
||
const list = r.data?.list || []
|
||
t.assert(list.length >= 1, `至少 1 条 SUCCESS 消费日志(${list.length})`)
|
||
const hit = list[0]
|
||
t.assert(hit?.status === 'SUCCESS', `留痕状态 SUCCESS(${hit?.status})`)
|
||
t.assert(hit?.deliveryTaskId === target.id, `消费日志关联到任务(${hit?.deliveryTaskId})`)
|
||
t.assert(!!hit?.appId, `appId 已记录(${hit?.appId})`)
|
||
t.assert(!!hit?.callTime, `callTime 已记录`)
|
||
})
|
||
|
||
await t.step('正向 3:任务的 callCount 与消费日志条数一致', async () => {
|
||
const info = await t.api('GET', `/api/ssw/tdc/DeliveryTask/${target.id}`)
|
||
t.assert(info.code === 200, `任务详情 200`)
|
||
t.assert(info.data?.callCount >= 1, `callCount >= 1(${info.data?.callCount})`)
|
||
const r = await t.api('GET', `/api/ssw/tdc/ApiConsumeLog?currentPage=1&pageSize=50&deliveryTaskId=${target.id}&status=SUCCESS`)
|
||
t.assert((r.data?.list || []).length >= 1, `至少 1 条 SUCCESS 留痕`)
|
||
})
|
||
} |