From a92b6111ae68a6f51897487739f703f1b6029016 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Fri, 6 Mar 2026 20:17:40 +0000 Subject: [PATCH] auto(agent): enhance offers tests with message length validation --- backend/src/__tests__/offers.test.js | 28 +++++++++++++++++++++++++++ docs/runtime/pick_next_task_state.env | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) 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