auto(agent): enhance reviews route with additional validation tests

This commit is contained in:
OpenClaw 2026-03-06 20:45:13 +00:00
parent bc32b660be
commit 3d217914dc
3 changed files with 87 additions and 2 deletions

View file

@ -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);
});