This commit is contained in:
2026-08-17 18:32:38 +08:00
parent 5c22018edd
commit 5199146e97
13 changed files with 194 additions and 17 deletions
@@ -3,13 +3,18 @@ import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { EXPORT_SPECS, run } from './finance-downloads.mjs'
import { EXPORT_SPECS, REQUIRED_PERMISSIONS, run } from './finance-downloads.mjs'
import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'finance-downloads.mjs'), 'utf8')
test('八类 Finance XLSX 契约均有正式表头并在完整链末尾执行', () => {
assert.deepEqual(REQUIRED_PERMISSIONS, [
'platform:download:list', 'platform:finance:customer-account:export',
'platform:finance:customer-arap:export', 'platform:finance:customer-statement:export',
'platform:finance:settlement-ar:export', 'platform:finance:settlement-ap:export',
])
assert.deepEqual(Object.keys(EXPORT_SPECS), [
'FINANCE_CUSTOMER_ACCOUNT_LIST', 'FINANCE_CUSTOMER_ACCOUNT_LEDGER', 'FINANCE_FEE_SOURCE_LIST',
'FINANCE_RECONCILIATION_STATEMENT_LIST', 'FINANCE_RECEIVABLE_SETTLEMENT_LIST',
@@ -39,11 +44,17 @@ test('未部署时能力探测后记录部署前置,不借历史业务数据',
const steps = []; const gaps = []
const context = {
marker: 'ADMIN-API-PROBE', createdResources: {},
apiSuccess(module, name) { steps.push({ module, name, passed: false }); return null },
apiSuccess(module, name, response) {
const passed = response.http === 200 && String(response.body?.code) === '200'
steps.push({ module, name, passed }); return passed ? response.body.data : null
},
assert(module, name) { steps.push({ module, name, passed: false }) },
addStep(module, name, response, passed, evidence, options) { steps.push({ module, name, passed, evidence, options }) },
addCoverageGap(...args) { gaps.push(args) },
async request() { return { http: 200, body: { code: 'A0403', message: 'not deployed' } } },
async request(method, path) {
if (path.endsWith('/authorization/permissions')) return { http: 200, body: { code: '200', data: REQUIRED_PERMISSIONS } }
return { http: 200, body: { code: 'A0403', message: 'not deployed' } }
},
}
await run(context)
assert.equal(context.createdResources.financeExportTasks.marker, context.marker)