feat: finalize lease documents and IRL revisions
This commit is contained in:
1 parent
f127c69a28
commit
1bf6a3449c
196 files changed
+20564
-666
No files matched your search
+32
-10
@@ -259,7 +259,25 @@ test('creates a tenant with an attachment and a lease with a guarantor', async (
|
||||
await page.route('**/api/leases**', async (route) => {
|
||||
const request = route.request();
|
||||
const path = new URL(request.url()).pathname;
|
||||
if (request.method() === 'POST' && path === '/api/leases/lease-1/revisions') {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
json: {
|
||||
number: 1,
|
||||
templateVersion: '2026-01',
|
||||
sourceFingerprint: 'source-fingerprint',
|
||||
sha256: 'lease-sha256',
|
||||
generatedAt: '2026-07-19T12:00:00Z',
|
||||
authorId: 'owner-1',
|
||||
annexes: [],
|
||||
warningCodes: [],
|
||||
warnings: [],
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (request.method() === 'GET' && path.endsWith('/pdf')) {
|
||||
expect(path).toBe('/api/leases/lease-1/revisions/1/pdf');
|
||||
await route.fulfill({
|
||||
contentType: 'application/pdf',
|
||||
headers: { 'Content-Disposition': 'attachment; filename="bail-lease-1.pdf"' },
|
||||
@@ -267,15 +285,19 @@ test('creates a tenant with an attachment and a lease with a guarantor', async (
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (request.method() === 'POST') {
|
||||
const lease = { id: 'lease-1', ...request.postDataJSON() };
|
||||
if (request.method() === 'POST' && path === '/api/leases') {
|
||||
const lease = { id: 'lease-1', status: 'DRAFT', ...request.postDataJSON() };
|
||||
leases.push(lease);
|
||||
await route.fulfill({ contentType: 'application/json', json: lease });
|
||||
return;
|
||||
}
|
||||
await route.fulfill({ contentType: 'application/json', json: leases });
|
||||
});
|
||||
await page.route('**/api/rent-dues', (route) =>
|
||||
await page.route('**/api/rent-dues/refresh', (route) => {
|
||||
expect(route.request().method()).toBe('POST');
|
||||
return route.fulfill({ contentType: 'application/json', json: [] });
|
||||
});
|
||||
await page.route('**/api/lease-clauses?context=*', (route) =>
|
||||
route.fulfill({ contentType: 'application/json', json: [] }),
|
||||
);
|
||||
|
||||
@@ -306,8 +328,7 @@ test('creates a tenant with an attachment and a lease with a guarantor', async (
|
||||
await page.getByRole('combobox', { name: 'Locataires' }).click();
|
||||
await page.getByRole('option', { name: 'Camille Martin' }).click();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByLabel('Date de début').fill('2026-09-01');
|
||||
await page.getByLabel('Date de fin').fill('2027-08-31');
|
||||
await page.getByLabel("Date d'entrée").fill('2026-09-01');
|
||||
await page.getByLabel('Loyer mensuel').fill('850');
|
||||
await page.getByLabel('Charges mensuelles').fill('50');
|
||||
await page.getByLabel('Dépôt de garantie').fill('850');
|
||||
@@ -320,9 +341,9 @@ test('creates a tenant with an attachment and a lease with a guarantor', async (
|
||||
await expect(page.getByRole('heading', { name: 'Studio République' })).toBeVisible();
|
||||
await expect(page.getByText('Alex Durand')).toBeVisible();
|
||||
const downloadPromise = page.waitForEvent('download');
|
||||
await page.getByRole('button', { name: 'Télécharger le bail' }).click();
|
||||
await page.getByRole('button', { name: 'Générer / télécharger le bail' }).click();
|
||||
const download = await downloadPromise;
|
||||
expect(download.suggestedFilename()).toBe('bail-lease-1.pdf');
|
||||
expect(download.suggestedFilename()).toBe('bail-lease-1-revision-1.pdf');
|
||||
await expectNoHorizontalOverflow(page);
|
||||
});
|
||||
|
||||
@@ -372,9 +393,10 @@ test('records a received rent payment and keeps its surplus visible', async ({ p
|
||||
await page.route('**/api/leases', (route) =>
|
||||
route.fulfill({ contentType: 'application/json', json: [lease] }),
|
||||
);
|
||||
await page.route('**/api/rent-dues', (route) =>
|
||||
route.fulfill({ contentType: 'application/json', json: rentDues }),
|
||||
);
|
||||
await page.route('**/api/rent-dues/refresh', (route) => {
|
||||
expect(route.request().method()).toBe('POST');
|
||||
return route.fulfill({ contentType: 'application/json', json: rentDues });
|
||||
});
|
||||
await page.route('**/api/rent-payments', async (route) => {
|
||||
if (route.request().method() === 'POST') {
|
||||
submittedPayment = route.request().postDataJSON() as Record<string, unknown>;
|
||||
|
||||
Reference in new issue
Block a user