auto(agent): Add authentication tests to offers route
This commit is contained in:
parent
e433471589
commit
b4edaead35
2 changed files with 38 additions and 2 deletions
|
|
@ -128,3 +128,39 @@ test('POST /offers/negotiation/:offerId should return 400 for message exceeding
|
||||||
});
|
});
|
||||||
assert.strictEqual(response.statusCode, 400);
|
assert.strictEqual(response.statusCode, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test for missing authentication
|
||||||
|
test('POST /offers/:requestId should return 401 for unauthenticated request', async () => {
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/offers/1',
|
||||||
|
payload: {
|
||||||
|
amountChf: 50,
|
||||||
|
message: 'I can help with this'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assert.strictEqual(response.statusCode, 401);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test for missing authentication in negotiation
|
||||||
|
test('POST /offers/negotiation/:offerId should return 401 for unauthenticated request', async () => {
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/offers/negotiation/1',
|
||||||
|
payload: {
|
||||||
|
amountChf: 60,
|
||||||
|
message: 'What about this amount?'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assert.strictEqual(response.statusCode, 401);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test for missing authentication in accept
|
||||||
|
test('POST /offers/accept/:offerId should return 401 for unauthenticated request', async () => {
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/offers/accept/1',
|
||||||
|
payload: {}
|
||||||
|
});
|
||||||
|
assert.strictEqual(response.statusCode, 401);
|
||||||
|
});
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
LAST_ROUTE=helpRequests.js
|
LAST_ROUTE=offers.js
|
||||||
UPDATED_AT=2026-03-06T20:33:06Z
|
UPDATED_AT=2026-03-06T20:34:06Z
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue