/** 功能描述:静态检查本点资料专用卡片和非 JSON 错误保护。版本:v1.0.0。 */ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; const root = resolve(import.meta.dirname, '..'); const profilePage = readFileSync(resolve(root, 'src/views/shared/DeliveryProfilePage.vue'), 'utf8'); const resourcePage = readFileSync(resolve(root, 'src/views/shared/ResourcePage.vue'), 'utf8'); const httpClient = readFileSync(resolve(root, 'src/api/http.ts'), 'utf8'); assert.match(resourcePage, /definition\.name === 'delivery_profile'/, '本点资料未使用专用页面'); for (const field of ['配送点编码', '负责人', '配送点地址', '所属气站', '配送点标识']) { assert.ok(profilePage.includes(field), `资料卡缺少字段:${field}`); } assert.doesNotMatch(profilePage, /详情|分页|关键字/, '资料卡不应保留通用列表交互'); assert.match(httpClient, /response\.text\(\)/, 'HTTP 客户端未兼容非 JSON 响应'); assert.match(httpClient, /HTTP \$\{response\.status\}/, 'HTTP 客户端未提供状态码错误'); console.log('配送点资料页检查通过:专用只读卡片与非 JSON 错误保护已启用。');