import test from 'node:test' import assert from 'node:assert/strict' import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' const here = path.dirname(fileURLToPath(import.meta.url)) const acceptance = fs.readFileSync(path.join(here, '..', 'admin-test-env-acceptance.mjs'), 'utf8') const system = fs.readFileSync(path.join(here, 'system.mjs'), 'utf8') test('客户验收覆盖审核资质上传、回查和鉴权下载', () => { assert.match(acceptance, /files\/qualifications\/\$\{tenantId\}\/required-package/) assert.match(acceptance, /BUSINESS_LICENSE/) assert.match(acceptance, /LEGAL_PERSON_ID/) assert.match(acceptance, /requestBinary\('GET', `\/api\/platform\/v1\/files\/qualifications\/\$\{tenantId\}/) assert.match(acceptance, /downloadResponse\.bytes\.length > 0/) }) test('系统验收覆盖后端四种权限资源类型并清理测试资源', () => { for (const type of ['BUTTON', 'MENU', 'PAGE', 'API']) assert.match(system, new RegExp(`type: '${type}'`)) assert.match(system, /created\?\.permissionType === definition\.type/) assert.match(system, /created\?\.httpMethod/) assert.match(system, /DELETE.*permissions\/\$\{additionalPermissionId\}/s) }) test('客户验收覆盖客户维度操作日志列表和详情快照', () => { assert.match(acceptance, /audit\/logs\?accountId=\$\{tenantId\}&eventType=PLATFORM_TENANT_UPDATE&resourceType=TENANT&resourceId=\$\{tenantId\}/) assert.match(acceptance, /PLATFORM_TENANT_UPDATE/) assert.match(acceptance, /audit\/logs\/\$\{customerAuditRow\.id\}/) assert.match(acceptance, /JSON\.parse\(auditDetail\[field\]\)/) assert.match(acceptance, /snapshotsAreRedacted/) })