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

58 lines
2.5 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-CONTRACT_API-005 · 查询合约签订时显示正确结果
* REQ-056 [FL-5.2] 正向/边界值 P1
*
* 前置:已准备一条可查看记录、一条无权限记录和一个不存在的查询条件。
* 步骤:1. 用正确条件查询合约签订
* 2. 用不存在的条件查询
* 3. 用无权限账号查询
* 预期:正确条件能查到记录;没有数据时显示空结果;无权限时不显示数据。
*/
export const meta = {
tc: 'TC-CONTRACT_API-005',
req: 'REQ-056',
title: '查询合约签订时显示正确结果',
type: '正向/边界值',
priority: 'P1',
route: '',
needs: ['be']
}
export async function run(t) {
let target = null
await t.step('前置:登录并取一条已存在的合约作为查询样本', async () => {
await t.login()
const list = await t.apiList('/api/ssw/tds/Contract', { pageSize: 5 })
if (!list.length) t.skip('库中无合约数据')
target = list[0]
t.assert(true, `选用 ${target.contractCode}(id=${target.id})`)
})
await t.step('用正确条件:合约标识精确命中', async () => {
const list = await t.apiList('/api/ssw/tds/Contract', { keyword: target.contractCode })
const hit = list.find((x) => x.id === target.id)
t.assert(!!hit, `关键字 ${target.contractCode} 命中目标记录`)
t.assert(hit.contractCode === target.contractCode, '返回记录的合约标识一致')
})
await t.step('按状态过滤(如 02 已生效):返回的记录 status 全为 02', async () => {
const list = await t.apiList('/api/ssw/tds/Contract', { status: '02', pageSize: 20 })
t.assert(list.every((x) => x.status === '02'), `状态过滤后所有记录 status==02(共 ${list.length} 条)`)
})
await t.step('按不存在的关键字查询:返回空集', async () => {
const list = await t.apiList('/api/ssw/tds/Contract', { keyword: '__not_exist_' + t.runId })
t.assert(list.length === 0, `空关键字返回 0 条(实际 ${list.length})`)
})
await t.step('用无效 token 查询:应返回登录过期(不暴露数据)', async () => {
const r = await t.api('GET', '/api/ssw/tds/Contract?pageSize=5', null, {
token: 'bearer __INVALID__TOKEN__',
raw: true
})
t.assert(r.status === 200, `HTTP 仍为 200,由 code 字段控制业务态(实际 ${r.status})`)
t.assert(r.json.code !== 200, `业务码非 200(实际 ${r.json.code})`)
t.assert(r.json.data === null || r.json.data === undefined || !r.json.data?.list, '接口未返回任何合约数据')
})
}