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

88 lines
4.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-PLATFORM-007 · 条件不满足时不能办理数据产品上架
* REQ-037 [FL-10.2] 反向/等价类 P0
*
* 前置:1. 【数据提供】或【数据使用】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开【数据提供】或【数据使用】
* 2. 使用无权限账号或错误数据办理数据产品上架
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理数据产品上架,并说明原因。原有数据和状态不变。
*
* 注:上架前置校验(必填发布字段、必填交付配置、必填 tdsSpaceId)都要覆盖。
*/
export const meta = {
tc: 'TC-PLATFORM-007',
req: 'REQ-037',
title: '条件不满足时不能办理数据产品上架',
type: '反向/等价类',
priority: 'P0',
route: '/tdc/products',
needs: ['fe', 'be']
}
export async function run(t) {
let resource = null
const code = `E2E-PUBFAIL-${t.runId}`
await t.step('前置:登录并准备一条 publishFields/deliveryConfig 都缺的产品', async () => {
await t.login()
const res = await t.apiList('/api/ssw/tdc/Resource', { pageSize: 50 })
resource = res[0]
if (!resource) t.skip('库里没有数据资源,跳过')
const r = await t.api('POST', '/api/ssw/tdc/Product', {
productCode: code,
name: `上架失败-${t.runId}`,
resourceId: resource.id,
publishStatus: 'DRAFT'
// 故意不带 publishFields / deliveryConfig / tdsSpaceId
})
t.assert(r.code === 200, `准备 DRAFT 产品成功(实际 code=${r.code})`)
})
await t.step('缺 tdsSpaceId 时 Publish 应被拒', async () => {
const target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
const r = await t.api('PUT', `/api/ssw/tdc/Product/${target.id}/Publish`, {})
t.assert(r.code !== 200, `缺 spaceId 被拒(实际 code=${r.code})`)
t.assert(/空间|选择|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
const after = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
t.assert(after.publishStatus === 'DRAFT', `拒绝后状态保持 DRAFT(实际 ${after.publishStatus})`)
})
await t.step('缺 publishFields 时 Publish 应被拒', async () => {
const target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
const r = await t.api('PUT', `/api/ssw/tdc/Product/${target.id}/Publish`, {
tdsSpaceId: target.tdsSpaceId ?? 'placeholder-space'
})
t.assert(r.code !== 200, `缺 publishFields 被拒(实际 code=${r.code})`)
t.assert(/字段|配置|发布/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
})
await t.step('缺 deliveryConfig 时 Publish 应被拒', async () => {
// 给 publishFields 但仍缺 deliveryConfig
const target = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
await t.api('PUT', `/api/ssw/tdc/Product/${target.id}`, {
publishFields: 'id,name',
deliveryConfig: ''
})
const r = await t.api('PUT', `/api/ssw/tdc/Product/${target.id}/Publish`, {
tdsSpaceId: target.tdsSpaceId ?? 'placeholder-space'
})
t.assert(r.code !== 200, `缺 deliveryConfig 被拒(实际 code=${r.code})`)
t.assert(/交付|配置|失败/i.test(r.msg || ''), `错误信息说明原因(实际「${r.msg}」)`)
const after = (await t.apiList('/api/ssw/tdc/Product', { keyword: code }))[0]
t.assert(after.publishStatus === 'DRAFT', `拒绝后状态保持 DRAFT(实际 ${after.publishStatus})`)
})
await t.step('对不存在的 ID 调 Publish 应被拒', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Product/non-exist-id-xxxx/Publish', {})
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, `无意义回调被拒(实际 code=${r.code})`)
})
t.expectConsoleClean()
}