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
@@ -14,8 +14,8 @@ test('fixed customer supplier selection paginates and never creates a fallback',
async request(method, path) {
calls.push({ method, path })
const data = path.includes('/123?') ? supplier : path.includes('page=2')
? { records: [supplier], total: 101 }
: { records: Array.from({ length: 100 }, () => ({ id: '99', status: 'ACTIVE', category: 'BOOKING' })), total: 101 }
? { records: [supplier], size: 20, total: 21 }
: { records: Array.from({ length: 20 }, () => ({ id: '99', status: 'ACTIVE', category: 'BOOKING' })), size: 20, total: 21 }
return { body: { data } }
},
apiSuccess(_module, _name, response) { return response.body.data },
@@ -30,6 +30,22 @@ test('fixed customer supplier selection paginates and never creates a fallback',
})
const here = path.dirname(fileURLToPath(import.meta.url))
test('reused suppliers must match carrier and trucking scope in both list and detail', async () => {
for (const criteria of [{ carrierCode: 'MATSON' }, { truckingScope: 'OVERSEAS' }]) {
const good = { id: '123', category: 'BOOKING', status: 'ACTIVE', carrierCodes: ['MATSON'], truckingScope: 'OVERSEAS' }
let detail = good
const context = { options: { fixedCustomerId: '456' }, marker: 'REUSE',
async request(method, path) {
assert.equal(method, 'GET')
return { body: { data: path.includes('/123?') ? detail : { records: [
{ ...good, id: '999', carrierCodes: [], truckingScope: 'DOMESTIC' }, good], total: 2 } } }
}, apiSuccess(_module, _name, response) { return response.body.data }, addStep() {},
}
assert.equal((await loadSupplier(context, 'BOOKING', criteria)).id, '123')
detail = { ...good, carrierCodes: [], truckingScope: 'DOMESTIC' }
assert.equal(await loadSupplier(context, 'BOOKING', criteria), null)
}
})
const source = fs.readFileSync(path.join(here, 'finance-full-fixtures.mjs'), 'utf8')
test('finance fixture module is independently exported and marker isolated', () => {