auto(agent): enhance offers tests with message length validation

This commit is contained in:
OpenClaw 2026-03-06 20:17:40 +00:00
parent f831cf4290
commit a92b6111ae
2 changed files with 30 additions and 2 deletions

View file

@ -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);
});