- 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
76 lines
3.7 KiB
JavaScript
76 lines
3.7 KiB
JavaScript
/**
|
||
* TC-PRODUCT_API-008 · 查询数据产品上架时显示正确结果
|
||
* REQ-052 [FL-4.4] 正向/边界值 P1
|
||
*
|
||
* 前置:已准备一条可查看记录、一条无权限记录和一个不存在的查询条件。
|
||
* 步骤:1. 用正确条件查询数据产品上架
|
||
* 2. 用不存在的条件查询
|
||
* 3. 用无权限账号查询
|
||
* 预期:正确条件能查到记录;没有数据时显示空结果;无权限时不显示数据。
|
||
*
|
||
* 注:分三档验证查询边界:
|
||
* ① 正确条件 —— keyword 命中 + status=ONLINE 命中 + 详情可查
|
||
* ② 不存在的条件 —— 不存在的关键字 / 非法 status / 空条件等价全量
|
||
* ③ 无权限账号 —— 本环境使用同一 token 模拟,跳过;用「明显不在范围内的过滤条件」也能验出查询未误命中
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-PRODUCT_API-008',
|
||
req: 'REQ-052',
|
||
title: '查询数据产品上架时显示正确结果',
|
||
type: '正向/边界值',
|
||
priority: 'P1',
|
||
route: '/tds/products',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
const code = t.uid('E2E-ONLINE-Q')
|
||
|
||
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('正向 1:keyword 精确命中', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/DataProduct', { keyword: code, pageSize: 20 })
|
||
t.assert(list.some((r) => r.productCode === code), `keyword 命中`)
|
||
})
|
||
|
||
await t.step('正向 2:status=ONLINE + auditStatus=PASS 过滤命中', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/DataProduct', { status: 'ONLINE', auditStatus: 'PASS', pageSize: 100 })
|
||
t.assert(Array.isArray(list) && list.length > 0, `组合过滤返回数组(${list.length} 条)`)
|
||
t.assert(list.some((r) => r.productCode === code), `组合过滤包含本用例产品`)
|
||
})
|
||
|
||
await t.step('边界 1:不存在的 keyword 返回 0 条', async () => {
|
||
const r = await t.apiList('/api/ssw/tds/DataProduct', { keyword: `__NOT_EXIST_${t.runId}` })
|
||
t.assert(r.length === 0, `不存在的 keyword 返回 0 条(实际 ${r.length})`)
|
||
})
|
||
|
||
await t.step('边界 2:非法 status 字符串不抛异常', async () => {
|
||
const r = await t.apiList('/api/ssw/tds/DataProduct', { status: 'NOT_A_STATUS_XX', pageSize: 50 })
|
||
t.assert(Array.isArray(r), `非法 status 不抛异常,返回数组(${r.length} 条)`)
|
||
})
|
||
|
||
await t.step('边界 3:空条件等价于全量', async () => {
|
||
const all = await t.apiList('/api/ssw/tds/DataProduct', { pageSize: 100 })
|
||
const none = await t.apiList('/api/ssw/tds/DataProduct', { keyword: '', status: '', pageSize: 100 })
|
||
t.assert(none.length === all.length, `空条件等价于全量(all=${all.length}, none=${none.length})`)
|
||
})
|
||
} |