feat(rental): add inventory and condition reports (#7)
This commit is contained in:
1 parent
92d8a3e351
commit
e4be5cd05f
193 files changed
+9697
-483
No files matched your search
@@ -37,7 +37,7 @@ describe('LeaseFinalizationService', () => {
|
||||
expect(formData.get('attestation')).toBe('true');
|
||||
});
|
||||
|
||||
it('keeps the civil signature date string and repeated warnings unchanged', () => {
|
||||
it('sends the signed PDF and a native JSON metadata part', async () => {
|
||||
const file = new File(['lease'], 'bail-signe.pdf', { type: 'application/pdf' });
|
||||
TestBed.inject(LeaseFinalizationService)
|
||||
.finalize('lease-1', {
|
||||
@@ -47,16 +47,46 @@ describe('LeaseFinalizationService', () => {
|
||||
allPartiesSigned: true,
|
||||
revisionMatches: true,
|
||||
confirmedWarningCodes: ['DPE_OVERRIDE', 'RENT_OVERRIDE'],
|
||||
entryInventoryDiscrepancies: true,
|
||||
inventoryCorrections: [
|
||||
{
|
||||
id: 'correction-1',
|
||||
inventoryLineId: null,
|
||||
privateAreaId: 'area-1',
|
||||
designation: 'Chaise',
|
||||
quantity: 0,
|
||||
description: 'Absente',
|
||||
},
|
||||
],
|
||||
allInventoryCorrectionsInitialed: true,
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
const formData = http.post.mock.calls[0][1] as FormData;
|
||||
expect(http.post.mock.calls[0][0]).toBe('/api/leases/lease-1/finalization');
|
||||
expect(formData.get('signedLease')).toBe(file);
|
||||
expect(formData.get('revisionNumber')).toBe('4');
|
||||
expect(formData.get('lastSignatureDate')).toBe('2026-07-19');
|
||||
expect(formData.get('allPartiesSigned')).toBe('true');
|
||||
expect(formData.get('revisionMatches')).toBe('true');
|
||||
expect(formData.getAll('confirmedWarningCodes')).toEqual(['DPE_OVERRIDE', 'RENT_OVERRIDE']);
|
||||
const metadata = formData.get('metadata');
|
||||
expect(metadata).toBeInstanceOf(Blob);
|
||||
await expect((metadata as Blob).text()).resolves.toBe(
|
||||
JSON.stringify({
|
||||
revisionNumber: 4,
|
||||
lastSignatureDate: '2026-07-19',
|
||||
allPartiesSigned: true,
|
||||
revisionMatches: true,
|
||||
confirmedWarningCodes: ['DPE_OVERRIDE', 'RENT_OVERRIDE'],
|
||||
entryInventoryDiscrepancies: true,
|
||||
inventoryCorrections: [
|
||||
{
|
||||
id: 'correction-1',
|
||||
inventoryLineId: null,
|
||||
privateAreaId: 'area-1',
|
||||
designation: 'Chaise',
|
||||
quantity: 0,
|
||||
description: 'Absente',
|
||||
},
|
||||
],
|
||||
allInventoryCorrectionsInitialed: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user