const test = require('node:test'); const assert = require('assert'); const { app } = require('../app'); test('GET /reviews should return all reviews', async () => { const response = await app.inject({ method: 'GET', url: '/reviews' }); assert.strictEqual(response.statusCode, 200); assert.strictEqual(response.headers['content-type'], 'application/json; charset=utf-8'); }); test('POST /reviews should create a new review', async () => { const newReview = { title: 'Great product', content: 'I really enjoyed using this.', rating: 5 }; const response = await app.inject({ method: 'POST', url: '/reviews', payload: newReview }); assert.strictEqual(response.statusCode, 201); assert.strictEqual(response.headers['content-type'], 'application/json; charset=utf-8'); }); test('POST /reviews should return 400 for invalid review data', async () => { const invalidReview = { title: '', content: 'Some content', rating: 6 }; const response = await app.inject({ method: 'POST', url: '/reviews', payload: invalidReview }); assert.strictEqual(response.statusCode, 400); });