25 lines
1.6 KiB
JavaScript
25 lines
1.6 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = process.cwd();
|
|
const read = (relativePath) => readFileSync(path.join(root, relativePath), "utf8");
|
|
|
|
const featureService = read("src/services/systemFeatures.js");
|
|
const router = read("src/router/index.js");
|
|
const app = read("src/App.vue");
|
|
const systemExtension = read("src/views/SystemExtensionView.vue");
|
|
const productionLedger = read("src/views/ProductionLedgerView.vue");
|
|
|
|
assert.match(featureService, /smart-operation-report/, "feature service should load switch config");
|
|
assert.match(router, /operation-reports/, "router should still define operation report route");
|
|
assert.match(router, /loadSmartOperationReportConfig/, "router should guard operation-reports by switch");
|
|
assert.match(app, /smartOperationReportEnabled/, "App should track switch state");
|
|
assert.match(app, /child\.key\s*===\s*"operation-reports"/, "App should hide operation reports child when disabled");
|
|
assert.match(systemExtension, /对接智能报工小程序/, "system extension should show switch");
|
|
assert.doesNotMatch(productionLedger, /当前未对接智能报工小程序/, "production ledger page should not expose disabled integration wording");
|
|
assert.doesNotMatch(productionLedger, /工序明细隐藏/, "production ledger page should not expose hidden operation detail wording");
|
|
assert.doesNotMatch(productionLedger, /BOM毛重\/净重反推/, "production ledger page should not expose internal calculation wording");
|
|
|
|
console.log("smart operation report toggle static checks passed");
|