Files
platforms/frontend/platform_admin/scripts/check-gasorder-address-linkage.mjs
2026-08-13 22:50:37 +08:00

23 lines
1.6 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.
/**
* 功能:静态检查配送订单收货地址的可读展示、合同过滤与默认地址联动。
* 版本v1.0.0
*/
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const resources = readFileSync(new URL('../src/api/resources.ts', import.meta.url), 'utf8');
const display = readFileSync(new URL('../src/api/resource-display.ts', import.meta.url), 'utf8');
const linkage = readFileSync(new URL('../src/views/resource/use-resource-relation-linkage.ts', import.meta.url), 'utf8');
assert.match(resources, /label: '收货地址'/, '订单地址字段必须使用业务名称');
assert.match(resources, /relationOptionLabelKey: 'address'/, '订单地址选项必须显示完整地址');
assert.match(resources, /relationOptionDefaultKey: 'is_default'/, '订单地址选项必须标记默认地址');
assert.match(resources, /relationAutoSelectKey: 'is_default'/, '订单地址必须自动选择默认地址');
assert.match(resources, /filterKey: 'gasorder_contract_identity'/, '订单地址必须按配送合同过滤');
assert.match(resources, /该合同用户暂无收货地址,请先维护用户地址/, '缺少无地址时的业务引导');
assert.match(display, /默认地址/, '关联选项未实现默认地址标记');
assert.match(linkage, /active: ActiveLinkage\[\]/, '表单联动必须支持同一父级驱动多个子项');
assert.match(linkage, /unavailableMessage/, '必填候选为空时必须阻止无效提交');
console.log('配送订单地址检查通过:可读地址、默认标记、合同过滤、自动选择与空数据引导均已覆盖。');