feat: complete reporting and filing workflows

This commit is contained in:
hectorzhao
2026-07-28 20:28:47 +08:00
parent 352a6293b4
commit 99c8c7c68b
52 changed files with 3490 additions and 376 deletions
+13
View File
@@ -41,6 +41,19 @@ describe('ReportsService', () => {
expect(tx.$executeRaw).toHaveBeenCalledTimes(28);
});
it('calculates profit cost from channel unit price times delivered fragment count', async () => {
await service.refreshRollingWindow(new Date('2026-07-15T05:30:00.000Z'));
const firstDayQueries = tx.$executeRaw.mock.calls.slice(0, 7).map(([query]) =>
Array.isArray(query?.strings) ? query.strings.join(' ') : String(query),
);
const profitQueries = firstDayQueries.slice(1, 3).join('\n');
expect(profitQueries).toContain('"SmsMessageSegmentAudit"');
expect(profitQueries).toContain(`FILTER (WHERE audit."receiptStatus" = 'delivered')`);
expect(profitQueries).toContain('submit."costUnitPrice"');
expect(profitQueries).not.toContain('SUM(submit."costAmountCents")');
});
it('queries reconciliation reports with server-side filters and bounded pagination', async () => {
await expect(service.listReconciliation({
dateFrom: '2026-07-01',