test(acceptance): reuse fixed customers and align native fulfillment flows

This commit is contained in:
2026-10-23 04:48:02 +08:00
parent b92f7fe991
commit 139f6b1932
51 changed files with 1076 additions and 228 deletions
@@ -1,6 +1,27 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { buildAcceptanceSummary } from './admin-test-env-acceptance.mjs'
import { AcceptanceRun, parseArguments, buildAcceptanceSummary } from './admin-test-env-acceptance.mjs'
import { mkdtemp, writeFile, unlink, rmdir } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
test('explicit stop file waits for a module boundary and records an interrupted failure once', async () => {
const directory = await mkdtemp(join(tmpdir(), 'acceptance-stop-'))
const stopFile = join(directory, 'stop')
const run = new AcceptanceRun({ stopFile, quiet: true, modules: [] })
try {
assert.equal(parseArguments(['--stop-file', stopFile]).stopFile, stopFile)
assert.equal(await run.stopAtBoundary(), false)
await writeFile(stopFile, 'stop')
assert.equal(await run.stopAtBoundary(), true)
assert.equal(await run.stopAtBoundary(), true)
assert.match(run.fatal, /中止结果/)
assert.equal(run.steps.length, 1)
assert.equal(run.steps[0].passed, false)
assert.equal(buildAcceptanceSummary(run.steps, [], []).failed, 1)
assert.deepEqual(run.createdResources, {})
} finally { await unlink(stopFile).catch(error => { if (error.code !== 'ENOENT') throw error }); await rmdir(directory) }
})
test('report summary separates assertion, module-run and unique-request metrics', () => {
const sharedResponse = {