- 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
71 lines
3.3 KiB
JavaScript
71 lines
3.3 KiB
JavaScript
/**
|
||
* TC-PRODUCT_API-012 · 重复办理数据产品检索时不会重复处理
|
||
* REQ-053 [FL-4.2] 反向/状态迁移 P1
|
||
*
|
||
* 前置:已存在一条可以办理的数据产品检索记录。
|
||
* 步骤:1. 正常办理一次数据产品检索
|
||
* 2. 再次提交相同操作
|
||
* 3. 查看状态、列表和相关记录
|
||
* 预期:第一次按正常流程处理;第二次不会生成重复数据,状态和相关记录正确。
|
||
*
|
||
* 注:Catalog 是只读聚合视图,本身不写库,「重复检索」不会产生重复落库数据。
|
||
* 核心断言:连续两次调同一目录接口,返回的产品 id 集合一致(同一产品不会因多次检索
|
||
* 在目录里出现两条重复记录),且列表长度与单次检索一致。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-PRODUCT_API-012',
|
||
req: 'REQ-053',
|
||
title: '重复办理数据产品检索时不会重复处理',
|
||
type: '反向/状态迁移',
|
||
priority: 'P1',
|
||
route: '/tds/catalog',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
const code = t.uid('E2E-CAT-DUP')
|
||
|
||
await t.step('前置:登录、建一条产品并上架', async () => {
|
||
await t.login()
|
||
const spaces = await t.apiList('/api/ssw/tds/Space', { pageSize: 10 })
|
||
const space = spaces.find((s) => s.status === 'ONLINE' || s.status === 'ENABLED') || spaces[0]
|
||
if (!space) t.skip('库中无任何空间')
|
||
const conns = await t.apiList('/api/ssw/tds/Connector', { pageSize: 50 })
|
||
const conn = conns.find((c) => c.auditStatus === 'PASS') || conns[0]
|
||
if (!conn) t.skip('库中无任何连接器')
|
||
const create = await t.api('POST', '/api/ssw/tds/DataProduct', {
|
||
productCode: code,
|
||
name: `目录重复-测评-${t.runId}`,
|
||
spaceId: space.id,
|
||
providerConnectorId: conn.id
|
||
})
|
||
t.assert(create.code === 200, `建产品成功`)
|
||
t._newId = create.data
|
||
await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Submit`)
|
||
await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Audit`, { auditStatus: 'PASS', auditOpinion: 'ok' })
|
||
await t.api('PUT', `/api/ssw/tds/DataProduct/${t._newId}/Online`)
|
||
})
|
||
|
||
await t.step('第一次检索 ServiceList', async () => {
|
||
const r1 = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList')
|
||
t._len1 = (r1?.data || []).length
|
||
t.assert(t._len1 > 0, `第一次检索返回数组(${t._len1} 条)`)
|
||
})
|
||
|
||
await t.step('第二次检索 ServiceList:列表长度一致、无重复数据', async () => {
|
||
const r2 = await t.api('GET', '/api/ssw/tds/Catalog/ServiceList')
|
||
const arr2 = r2?.data || []
|
||
t.assert(arr2.length === t._len1, `两次检索列表长度一致(${t._len1} → ${arr2.length})`)
|
||
const count = arr2.filter((p) => p.id === t._newId).length
|
||
t.assert(count === 1, `同一产品只出现 1 次(实际 ${count} 次)`)
|
||
})
|
||
|
||
await t.step('ProviderList / TrialList 也保持稳定(聚合结果幂等)', async () => {
|
||
const p1 = await t.api('GET', '/api/ssw/tds/Catalog/ProviderList')
|
||
const p2 = await t.api('GET', '/api/ssw/tds/Catalog/ProviderList')
|
||
t.assert(p1.data.length === p2.data.length, `ProviderList 两次长度一致`)
|
||
const t1 = await t.api('GET', '/api/ssw/tds/Catalog/TrialList')
|
||
const t2 = await t.api('GET', '/api/ssw/tds/Catalog/TrialList')
|
||
t.assert(t1.data.length === t2.data.length, `TrialList 两次长度一致`)
|
||
})
|
||
} |