#!/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 repoRoot = path.resolve(path.dirname(scriptPath), '../../..') const inventoryPath = path.join(repoRoot, 'plugins/modern-api/generated/ui-inventory.json') const inventory = JSON.parse(await readFile(inventoryPath, 'utf8')) function page(pageId) { const definition = inventory.pageDefinitions?.[pageId] assert.ok(definition, `Expected generated page definition for ${pageId}`) return definition } function businessStatus(pageId) { return page(pageId).acceptance?.businessParityStatus } function scenarioText(pageId) { return JSON.stringify(page(pageId).acceptance?.e2eScenario || {}) } assert.equal( businessStatus('content__FindWebSite'), 'verified', 'read-only entity table pages with only navigation actions should be automatically business-verified' ) assert.match( scenarioText('content__FindWebSite'), /只读实体表格/, 'read-only entity table pages should explain why they were auto-verified' ) assert.equal( businessStatus('content__WebSiteAliasesSearchResults'), 'pending-business-e2e', 'tables with destructive row links must stay pending until real business E2E verifies them' ) assert.equal( businessStatus('accounting__listInvoiceItems'), 'pending-business-e2e', 'pages with executable service/groovy actions must stay pending' ) assert.equal( businessStatus('content__FindForumThreads'), 'pending-business-e2e', 'mixed search pages with executable update services must stay pending' ) console.log(JSON.stringify({ status: 'passed', checked: [ 'content__FindWebSite', 'content__WebSiteAliasesSearchResults', 'accounting__listInvoiceItems', 'content__FindForumThreads' ] }, null, 2))