diff --git a/backend/src/__tests__/offers.test.js b/backend/src/__tests__/offers.test.js index 9bb78bb..96dece7 100644 --- a/backend/src/__tests__/offers.test.js +++ b/backend/src/__tests__/offers.test.js @@ -99,4 +99,32 @@ test('POST /offers/accept/:offerId should return 404 for non-existent offer', as payload: {} }); assert.strictEqual(response.statusCode, 404); +}); + +// Additional test for validation of message length +test('POST /offers/:requestId should return 400 for message exceeding max length', async () => { + const longMessage = 'a'.repeat(2001); // 2001 characters + const response = await app.inject({ + method: 'POST', + url: '/offers/1', + payload: { + amountChf: 50, + message: longMessage + } + }); + assert.strictEqual(response.statusCode, 400); +}); + +// Additional test for validation of negotiation message length +test('POST /offers/negotiation/:offerId should return 400 for message exceeding max length', async () => { + const longMessage = 'a'.repeat(2001); // 2001 characters + const response = await app.inject({ + method: 'POST', + url: '/offers/negotiation/1', + payload: { + amountChf: 60, + message: longMessage + } + }); + assert.strictEqual(response.statusCode, 400); }); \ No newline at end of file diff --git a/docs/runtime/pick_next_task_state.env b/docs/runtime/pick_next_task_state.env index b5238c7..65bd48c 100644 --- a/docs/runtime/pick_next_task_state.env +++ b/docs/runtime/pick_next_task_state.env @@ -1,2 +1,2 @@ -LAST_ROUTE=auth.js -UPDATED_AT=2026-03-06T20:10:38Z +LAST_ROUTE=offers.js +UPDATED_AT=2026-03-06T20:17:13Z