feat: add payment report notes

This commit is contained in:
Jose Selesan
2026-10-28 16:45:55 -03:00
parent b22b6da2e1
commit b6f22ae67d
13 changed files with 64 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import { describe, expect, it } from 'bun:test';
import { REPORTED_PAYMENT_NOTE_MAX } from '@gruperly/shared';
import { detectReceiptType, RECEIPT_MAX_BYTES } from '@/lib/file-type';
import type { FileStorage } from '@/lib/storage';
import { occurrencesBetween, startOfWeekInTimeZone } from '@/modules/home/lib/scheduler';
@@ -45,6 +46,15 @@ describe('tipo real del comprobante (magic bytes)', () => {
const noStorage = new ReportStudentPayment({ db: db as never, storage: null });
const unavailable = await noStorage.execute('acc', { attendeeId: 'a1', paymentIds: ['p1'], file: { name: 'a.pdf', bytes: pad(ascii('%PDF-1.7')) } });
expect(!unavailable.ok && unavailable.error.status).toBe(503);
const longNote = await useCase.execute('acc', {
attendeeId: 'a1',
paymentIds: ['p1'],
note: 'x'.repeat(REPORTED_PAYMENT_NOTE_MAX + 1),
file: { name: 'a.pdf', bytes: pad(ascii('%PDF-1.7')) },
});
expect(!longNote.ok && longNote.error.errors).toEqual({ note: ['too_long'] });
expect(puts).toEqual([]);
});
});