- 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
69 lines
3.2 KiB
JavaScript
69 lines
3.2 KiB
JavaScript
/**
|
||
* TC-PLATFORM-010 · 条件不满足时不能办理数据产品目录
|
||
* REQ-038 [FL-10.3] 反向/等价类 P0
|
||
*
|
||
* 前置:1. 【数据提供】或【数据使用】可以正常打开
|
||
* 2. 已准备无权限账号或错误数据
|
||
* 步骤:1. 打开【数据提供】或【数据使用】
|
||
* 2. 使用无权限账号或错误数据办理数据产品目录
|
||
* 3. 点击提交,查看提示和数据
|
||
* 预期:系统不允许办理数据产品目录,并说明原因。原有数据和状态不变。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-PLATFORM-010',
|
||
req: 'REQ-038',
|
||
title: '条件不满足时不能办理数据产品目录',
|
||
type: '反向/等价类',
|
||
priority: 'P0',
|
||
route: '/tdc/products',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let before = 0
|
||
|
||
await t.step('前置:登录并记录产品当前条数', async () => {
|
||
await t.login()
|
||
await t.goto('/tdc/products')
|
||
before = (await t.apiList('/api/ssw/tdc/Product')).length
|
||
t.assert(true, `目录提交前产品共 ${before} 条`)
|
||
})
|
||
|
||
await t.step('目录收录(Offline)原因不能为空:PUBLISHED 产品下架时 reason 缺省应被拒', async () => {
|
||
const list = await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })
|
||
const published = list.find((r) => r.publishStatus === 'PUBLISHED')
|
||
if (!published) t.skip('库里没有 PUBLISHED 的产品,跳过本步')
|
||
const r = await t.api('PUT', `/api/ssw/tdc/Product/${published.id}/Offline`, {})
|
||
t.assert(r.code !== 200, `缺 reason 被拒(实际 code=${r.code})`)
|
||
t.assert(/原因|不能为空|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
|
||
const after = (await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })).find((r) => r.id === published.id)
|
||
t.assert(after.publishStatus === 'PUBLISHED', `拒绝后状态保持 PUBLISHED(实际 ${after.publishStatus})`)
|
||
})
|
||
|
||
await t.step('对不存在的 ID 下架应被拒', async () => {
|
||
const r = await t.api('PUT', '/api/ssw/tdc/Product/non-exist-id-xxxx/Offline', { reason: '测试' })
|
||
t.assert(r.code !== 200, `不存在的 ID 被拒(实际 code=${r.code})`)
|
||
})
|
||
|
||
await t.step('PublishCallback 缺 publishStatus 应被拒', async () => {
|
||
const r = await t.api('PUT', '/api/ssw/tdc/Product/non-exist-id-yyy/PublishCallback', {})
|
||
t.assert(r.code !== 200, `缺 publishStatus 被拒(实际 code=${r.code})`)
|
||
})
|
||
|
||
await t.step('非 PUBLISHING 状态的产品回调审核结果应被拒', async () => {
|
||
const list = await t.apiList('/api/ssw/tdc/Product', { pageSize: 50 })
|
||
const notPublishing = list.find((r) => r.publishStatus !== 'PUBLISHING')
|
||
if (!notPublishing) t.skip('库里没有非 PUBLISHING 的产品,跳过本步')
|
||
const r = await t.api('PUT', `/api/ssw/tdc/Product/${notPublishing.id}/PublishCallback`, {
|
||
publishStatus: 'PUBLISHED'
|
||
})
|
||
t.assert(r.code !== 200, `非 PUBLISHING 回调被拒(实际 code=${r.code})`)
|
||
})
|
||
|
||
await t.step('核对原有数据和状态不变', async () => {
|
||
const after = (await t.apiList('/api/ssw/tdc/Product')).length
|
||
t.assert(after === before, `列表条数不变(${before} → ${after}),未产生脏数据`)
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |