auto(agent): Add comprehensive tests for reviews route including valid dealId cases
This commit is contained in:
parent
1e37764fe1
commit
1c45c58570
2 changed files with 38 additions and 2 deletions
|
|
@ -187,4 +187,40 @@ test('POST /reviews should return 400 for missing rating', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.strictEqual(response.statusCode, 400);
|
assert.strictEqual(response.statusCode, 400);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Additional test for valid dealId (number)
|
||||||
|
test('POST /reviews should accept valid numeric dealId', async () => {
|
||||||
|
const newReview = {
|
||||||
|
dealId: 1,
|
||||||
|
revieweeId: 2,
|
||||||
|
rating: 5,
|
||||||
|
comment: 'Great product'
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/reviews/1',
|
||||||
|
payload: newReview
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(response.statusCode, 201);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Additional test for valid dealId (string number)
|
||||||
|
test('POST /reviews should accept valid string numeric dealId', async () => {
|
||||||
|
const newReview = {
|
||||||
|
dealId: '1',
|
||||||
|
revieweeId: 2,
|
||||||
|
rating: 5,
|
||||||
|
comment: 'Great product'
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/reviews/1',
|
||||||
|
payload: newReview
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(response.statusCode, 201);
|
||||||
});
|
});
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
LAST_ROUTE=profile.js
|
LAST_ROUTE=reviews.js
|
||||||
UPDATED_AT=2026-03-06T21:01:14Z
|
UPDATED_AT=2026-03-06T21:03:06Z
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue