- 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
78 lines
3.1 KiB
JavaScript
78 lines
3.1 KiB
JavaScript
/**
|
||
* TC-SPACE-004 · 条件不满足时不能办理成员管理
|
||
* REQ-015 [FL-2.3] 反向/等价类 P0
|
||
*
|
||
* 前置:【空间成员】可打开 / 已准备错误数据
|
||
* 步骤:使用错误数据办理成员管理 → 查看提示与数据
|
||
* 预期:系统不允许办理并说明原因;原有数据和状态不变
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-SPACE-004',
|
||
req: 'REQ-015',
|
||
title: '条件不满足时不能办理成员管理',
|
||
type: '反向/等价类',
|
||
priority: 'P0',
|
||
route: '/tds/space-members',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.login()
|
||
let pending = null
|
||
let approved = null
|
||
|
||
await t.step('前置:取 PENDING 与 APPROVED 的成员样本', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/SpaceMember', { pageSize: 50 })
|
||
pending = list.find((r) => r.auditStatus === 'PENDING')
|
||
approved = list.find((r) => r.auditStatus === 'APPROVED')
|
||
t.assert(true, `PENDING=${pending?.id ?? '-'}, APPROVED=${approved?.id ?? '-'}`)
|
||
})
|
||
|
||
await t.step('新建缺 spaceId / orgId 被拒', async () => {
|
||
const cases = [
|
||
{ body: {}, need: /spaceId|为空/ },
|
||
{ body: { spaceId: 'x' }, need: /orgId|为空/ }
|
||
]
|
||
for (const c of cases) {
|
||
const r = await t.api('POST', '/api/ssw/tds/SpaceMember', c.body)
|
||
t.assert(r.code !== 200, `缺关键字段被拒(code=${r.code})`)
|
||
t.assert(c.need.test(r.msg || ''), `提示命中「${c.need}」(实际「${r.msg}」)`)
|
||
}
|
||
})
|
||
|
||
await t.step('APPROVED 再次 Approve 被拒(状态机)', async () => {
|
||
if (!approved) t.skip('库中没有 APPROVED 记录,跳过')
|
||
const r = await t.api('POST', `/api/ssw/tds/SpaceMember/${approved.id}/Approve`, {
|
||
auditOpinion: '再次审批'
|
||
})
|
||
t.assert(r.code !== 200, `非 PENDING 审批被拒(code=${r.code})`)
|
||
t.assert(/状态|允许|不在/.test(r.msg || ''), `提示说明状态不允许(实际「${r.msg}」)`)
|
||
})
|
||
|
||
await t.step('PENDING Reject 但 auditOpinion 为空被拒', async () => {
|
||
if (!pending) t.skip('库中没有 PENDING 记录,跳过')
|
||
const r = await t.api('POST', `/api/ssw/tds/SpaceMember/${pending.id}/Reject`, {
|
||
auditOpinion: ''
|
||
})
|
||
t.assert(r.code !== 200, `空意见 Reject 被拒(code=${r.code})`)
|
||
t.assert(/意见|必填|为空/i.test(r.msg || ''), `提示说明意见必填(实际「${r.msg}」)`)
|
||
// 状态应保持 PENDING
|
||
const info = await t.api('GET', `/api/ssw/tds/SpaceMember/${pending.id}`)
|
||
t.assert(info.data.auditStatus === 'PENDING', `状态保持 PENDING(实际 ${info.data.auditStatus})`)
|
||
})
|
||
|
||
await t.step('不存在的 ID 走审批被拒', async () => {
|
||
const r = await t.api('POST', '/api/ssw/tds/SpaceMember/not-exist-id-aaa/Approve', { auditOpinion: 'x' })
|
||
t.assert(r.code !== 200, `不存在 ID 被拒(code=${r.code})`)
|
||
})
|
||
|
||
await t.step('界面核对缺必填项被拦截', async () => {
|
||
await t.goto('/tds/space-members')
|
||
await t.openCreate()
|
||
await t.save()
|
||
await t.expectReject('不能为空')
|
||
await t.cancelDrawer()
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |