import { NextResponse, NextRequest } from "next/server";
import { GET } from "@/app/api/book-reviews/route";

// Mock the route handler module
jest.mock("@/app/api/book-reviews/route", () => ({
  GET: jest.fn(),
}));

describe("GET /api/book-reviews", () => {
  it("should return book reviews", async () => {
    (GET as jest.Mock).mockResolvedValue(
      NextResponse.json({ bookReviews: [{ id: 1, book_title: "Test" }] })
    );

    const response = await GET({} as NextRequest);
    const data = await response.json();
    expect(response.status).toBe(200);
    expect(data.bookReviews).toHaveLength(1);
  });
});
