import { NextResponse } from "next/server";
import { GET } from "@/app/api/hobbies/route";

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

describe("GET /api/hobbies", () => {
  it("should return hobbies", async () => {
    (GET as jest.Mock).mockResolvedValue(
      NextResponse.json({ hobbies: [{ id: 1, title: "Gaming" }] })
    );

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