diff --git a/backend/src/__tests__/reviews.test.js b/backend/src/__tests__/reviews.test.js index 7da8747..a37da2a 100644 --- a/backend/src/__tests__/reviews.test.js +++ b/backend/src/__tests__/reviews.test.js @@ -87,4 +87,72 @@ test('POST /reviews should return 409 for already reviewed deal', async () => { }); assert.strictEqual(response.statusCode, 409); +}); + +test('POST /reviews should return 400 for invalid dealId', async () => { + const newReview = { + dealId: 'invalid', + revieweeId: 2, + rating: 5, + comment: 'Great product' + }; + + const response = await app.inject({ + method: 'POST', + url: '/reviews/invalid', + payload: newReview + }); + + assert.strictEqual(response.statusCode, 400); +}); + +test('POST /reviews should return 400 for invalid revieweeId', async () => { + const newReview = { + dealId: 1, + revieweeId: -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 invalid rating', async () => { + const newReview = { + dealId: 1, + revieweeId: 2, + rating: 0, + 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 invalid comment length', async () => { + const newReview = { + dealId: 1, + revieweeId: 2, + rating: 5, + comment: 'a'.repeat(2001) + }; + + const response = await app.inject({ + method: 'POST', + url: '/reviews/1', + payload: newReview + }); + + assert.strictEqual(response.statusCode, 400); }); \ No newline at end of file diff --git a/docs/runtime/pick_next_task_state.env b/docs/runtime/pick_next_task_state.env index bd48b77..ea168ef 100644 --- a/docs/runtime/pick_next_task_state.env +++ b/docs/runtime/pick_next_task_state.env @@ -1,2 +1,2 @@ -LAST_ROUTE=profile.js -UPDATED_AT=2026-03-06T20:36:17Z +LAST_ROUTE=reviews.js +UPDATED_AT=2026-03-06T20:37:06Z