#!/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), '..') async function source(file) { return readFile(path.join(appRoot, file), 'utf8') } const financeOperations = await source('src/components/erp/ErpFinanceOperationsWorkspace.vue') const renderer = await source('src/components/erp/ErpPageRenderer.vue') const previewVerifier = await source('scripts/verify-preview.mjs') const screenshotScript = await source('scripts/capture-admin-screenshots.mjs') const packageJson = await source('package.json') for (const text of [ '财务运营', '财务运营台', '发票队列', '发票查询', '发票列表', '收付款匹配', '账龄风险', '核销处理', '发票详情' ]) { assert.match(financeOperations, new RegExp(text), `custom finance operations workspace must expose ${text}`) } for (const text of [ 'data-modern-workspace="finance-operations"', 'data-modern-finance-search="true"', 'data-modern-invoice-table="true"', 'data-modern-finance-drawer="true"' ]) { assert.match(financeOperations, new RegExp(text), `finance operations workspace needs stable verification hook: ${text}`) } assert.match(financeOperations, /getEntityRows\('Invoice'/, 'finance operations workspace must load real Invoice rows from the entity API') assert.match(financeOperations, /getEntityRows\('Payment'/, 'finance operations workspace must load real Payment rows from the entity API') assert.match(financeOperations, /真实发票数据/, 'finance operations workspace must describe entity-backed invoice data') assert.match(financeOperations, /真实付款数据/, 'finance operations workspace must describe entity-backed payment data') assert.doesNotMatch( financeOperations, /fieldRows\.value\.map|actionRows\.value\.map\(\(action, index\)|字段来自当前 OFBiz 页面定义|个字段来自当前 OFBiz 页面定义|字段完整|发票号、往来方、状态和金额字段/, 'finance operations workspace must not synthesize invoices or payments from generated metadata' ) assert.match(renderer, /ErpFinanceOperationsWorkspace/, 'page renderer should import the custom finance operations workspace') assert.match(renderer, /isFinanceOperationsPage/, 'renderer should route invoice and payment pages through the finance operations workspace') assert.match(previewVerifier, /finance-invoices-page/, 'preview verification should smoke-test the custom invoice finder') assert.match(previewVerifier, /finance-payment-overview-page/, 'preview verification should smoke-test the custom payment overview') assert.match(screenshotScript, /business-page-finance-invoices/, 'screenshots should capture the invoice operations page') assert.match(packageJson, /verify:finance-operations/, 'package scripts should expose finance operations verification') console.log(JSON.stringify({ status: 'passed', checked: [ 'ErpFinanceOperationsWorkspace.vue', 'ErpPageRenderer.vue', 'verify-preview.mjs', 'capture-admin-screenshots.mjs', 'package.json' ] }, null, 2))