Files
platforms/frontend/delivery_admin/scripts/check-delivery-profile-page.mjs
2026-08-22 19:49:28 +08:00

20 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.
/** 功能描述:静态检查本点资料专用卡片和非 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 错误保护已启用。');