feat(P20T3-1,P20T3-2,P20T3-3): 对账批次引擎与ERP摘要出站后端

这个提交包含在:
2026-03-11 16:55:04 +08:00
父节点 41a169ea41
当前提交 fc0295249e
共修改 15 个文件,包含 3733 行新增和 28 行删除
@@ -209,6 +209,51 @@ describe('dispatchOutboxEvent', () => {
);
});
it('records summary and settlement bindings for travel reconciliation export', async () => {
const prisma = {
integrationBinding: {
upsert: vi.fn().mockResolvedValue({ id: 'binding-travel-1' }),
},
};
await dispatchOutboxEvent({
prisma,
config: { erpSyncEnabled: true, erpSyncProvider: 'mock' },
eventType: 'erp.travel.export',
payload: {
exportType: 'travel_reconciliation_summary',
entityType: 'travel_reconciliation_batch',
entityId: 'batch-1',
batchNo: 'TRB-20260311-0001',
},
});
expect(prisma.integrationBinding.upsert).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
where: {
provider_entity_type_local_id: {
provider: 'erp',
entity_type: 'travel_payable_summary',
local_id: 'batch-1',
},
},
}),
);
expect(prisma.integrationBinding.upsert).toHaveBeenNthCalledWith(
2,
expect.objectContaining({
where: {
provider_entity_type_local_id: {
provider: 'erp',
entity_type: 'travel_settlement_batch',
local_id: 'batch-1',
},
},
}),
);
});
it('loads IM channel and dispatches mock wecom message', async () => {
const prisma = {
notificationChannel: {