This commit is contained in:
2026-10-22 11:56:47 +08:00
parent 5d71af1ac9
commit de96e47d74
71 changed files with 1296 additions and 332 deletions
@@ -6,6 +6,21 @@ import { run, runQuoteSession, verifyOperations, requireCurrentFixture, fixtureC
import { AcceptanceRun } from '../admin-test-env-acceptance.mjs'
const copy = value => structuredClone(value)
test('fixed quote supplier is reused without creation or deactivation', async () => {
const { context } = harness(), request = context.request.bind(context), writes = []
context.options = { fixedCustomerId: '101' }
const supplier = { id: '901', name: 'Existing', category: 'TRUCKING', truckingScope: 'OVERSEAS', status: 'ACTIVE' }
context.request = async (method, path, ...args) => {
if (path.includes('/suppliers')) {
if (method !== 'GET') writes.push({ method, path })
return { http: 200, body: { code: '200', data: path.includes('/901') ? supplier : { records: [supplier], total: 1 } } }
}
return request(method, path, ...args)
}
await run(context)
assert.equal(context.createdResources.fleetQuoteAcceptance.supplierReused, true)
assert.deepEqual(writes, [])
})
function harness(fault) {
const marker = 'FLEET-CURRENT-RUN', tripNo = 'TR-CURRENT', departedAt = '2026-10-03T01:00:00Z'
const rows = new Map(), histories = new Map(), commands = new Map(), measuredKeys = new Map(), calls = []