#!/usr/bin/env node /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' import path from 'node:path' import { fileURLToPath } from 'node:url' const scriptPath = fileURLToPath(import.meta.url) const appRoot = path.resolve(path.dirname(scriptPath), '..') const pageVue = await readFile(path.join(appRoot, 'src/views/BusinessPageView.vue'), 'utf8') const tabbedDataPanelVue = await readFile(path.join(appRoot, 'src/components/erp/ErpTabbedDataPanel.vue'), 'utf8') const rendererVue = await readFile(path.join(appRoot, 'src/components/erp/ErpPageRenderer.vue'), 'utf8') const adapterVue = await readFile(path.join(appRoot, 'src/components/erp/ErpAdapterBlock.vue'), 'utf8') const displayTs = await readFile(path.join(appRoot, 'src/utils/display.ts'), 'utf8') const modernCss = await readFile(path.join(appRoot, 'src/styles/modern.css'), 'utf8') for (const text of [ "activeTab = ref('overview')", 'const businessDataTabs = computed(() => [', "{ id: 'overview', label: '处理台' }", "{ id: 'records', label: '资料明细' }", "{ id: 'actions', label: '处理动作' }", "{ id: 'flow', label: '操作记录' }", '已生成|界面规则|待输出比对|待验收|系统记录|页面配置|CodePreview|JSON\.stringify|{{\s*[^}]*pending-business-e2e[^}]*}}|待确认|规则与权限/, 'business page should use operational language instead of migration or acceptance wording' ) assert.doesNotMatch( pageVue, /prop="method" label="Method"|prop="path" label="Path"|apiContracts|endpointRows/, 'ordinary ERP business pages must not expose API contract tables' ) for (const text of ['处理台', '业务流转', '当前上下文', '业务记录', '业务参数已带入当前单据', '处理状态', '处理方式', '适用范围']) { assert.match(pageVue + rendererVue, new RegExp(text), `business copy should orient users around operation: ${text}`) } assert.doesNotMatch( pageVue, /业务审计|审计轨迹|已留痕/, 'generated business pages must not present synthesized front-end context as real audit records' ) assert.doesNotMatch( pageVue, /原 OFBiz 动作|旧 URL 参数|旧 GET|旧入口兼容|业务回归|功能等价|待业务回归|控制规则|页面规则|来源入口|来源参数/, 'operator-facing business pages must avoid migration, compatibility, and parity wording' ) assert.match(rendererVue, /'client-behavior': '表单联动'/, 'technical client-behavior blocks should render with a business-facing label') assert.match(rendererVue, /if \(block\.type === 'client-behavior'\) return '表单联动'/, 'renderer block titles should normalize client behavior blocks') assert.match(adapterVue, /function blockHeading\(\)/, 'adapter blocks should normalize technical block titles') assert.match(adapterVue, /kind\.value === 'client-behavior'\) return '表单联动'/, 'client behavior adapter blocks should not expose old technical titles') assert.doesNotMatch( pageVue + rendererVue + adapterVue, />\s*client-behavior\s*