auto(agent): enhance reviews route with additional validation tests
This commit is contained in:
parent
bc32b660be
commit
3d217914dc
3 changed files with 87 additions and 2 deletions
|
|
@ -154,5 +154,37 @@ test('POST /reviews should return 400 for invalid comment length', async () => {
|
|||
payload: newReview
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 400);
|
||||
});
|
||||
|
||||
test('POST /reviews should return 400 for missing revieweeId', async () => {
|
||||
const newReview = {
|
||||
dealId: 1,
|
||||
rating: 5,
|
||||
comment: 'Great product'
|
||||
};
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'POST',
|
||||
url: '/reviews/1',
|
||||
payload: newReview
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 400);
|
||||
});
|
||||
|
||||
test('POST /reviews should return 400 for missing rating', async () => {
|
||||
const newReview = {
|
||||
dealId: 1,
|
||||
revieweeId: 2,
|
||||
comment: 'Great product'
|
||||
};
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'POST',
|
||||
url: '/reviews/1',
|
||||
payload: newReview
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 400);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue