auto(agent): enhance offers tests with message length validation
This commit is contained in:
parent
f831cf4290
commit
a92b6111ae
2 changed files with 30 additions and 2 deletions
|
|
@ -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);
|
||||
});
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue