refactor(cleaner): batch query and controlled parallel order processing

This commit is contained in:
test
2026-03-16 21:47:13 +08:00
parent 9248be6310
commit 6a2fba0e57
8 changed files with 484 additions and 236 deletions

View File

@@ -138,6 +138,34 @@ describe('Cleaner Schema', () => {
expect(result.success).toBe(false)
})
it('should apply defaults for queryBatchSize and processConcurrency', () => {
const input = {
orderNumbers: ['SC12345678901234'],
materialCodes: ['MAT001'],
dryRun: false
}
const result = CleanerInputSchema.safeParse(input)
expect(result.success).toBe(true)
if (result.success) {
expect(result.data.queryBatchSize).toBe(100)
expect(result.data.processConcurrency).toBe(1)
}
})
it('should reject out-of-range processConcurrency', () => {
const input = {
orderNumbers: ['SC12345678901234'],
materialCodes: ['MAT001'],
dryRun: false,
processConcurrency: 21
}
const result = CleanerInputSchema.safeParse(input)
expect(result.success).toBe(false)
})
})
describe('validateCleanerInput', () => {