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
|
|
@ -127,4 +127,40 @@ test('POST /offers/negotiation/:offerId should return 400 for message exceeding
|
|||
}
|
||||
});
|
||||
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);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue