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

32 lines
1.2 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-COMPAT-006 · 标准格式数据可交换
* Q-COMPAT 兼容性 · 正向 · P1
* 预期:系统提供的数据交换格式符合相关国际/国家/行业/企业标准
*/
export const meta = {
tc: 'TC-COMPAT-006',
req: 'Q-COMPAT',
title: '标准格式数据可交换',
type: '正向',
priority: 'P1',
needs: ['be']
}
export async function run(t) {
// 接口遵循 JSON over HTTP,Content-Type 标准
const r = await fetch('http://localhost:30000/api/oauth/CurrentUser', {
headers: { Authorization: 'bearer fake' }
})
const ct = r.headers.get('content-type') || ''
t.assert(/application\/json/i.test(ct), `Content-Type 为 JSON(实际「${ct}」)`)
// 跨域/CORS:内网/同源 API 不一定返回 CORS 头,缺失不算缺陷;有则须为 * 或具体源
const cors = r.headers.get('access-control-allow-origin') || ''
if (cors) {
t.assert(cors === '*' || cors.startsWith('http'), `CORS 头存在(${cors})`)
} else {
t.log(' ℹ CORS 头未返回(同源/内网 API 无需跨域,跳过校验)')
}
await t.login()
const json = await t.api('GET', '/api/ssw/tds/Space?currentPage=1&pageSize=1')
t.assert(json.code === 200, `分页接口符合 ActionResult 标准包(code=${json.code})`)
}