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

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

describe("GET /api/tech-stack", () => {
  it("should return tech stack", async () => {
    (GET as jest.Mock).mockResolvedValue(
      NextResponse.json({ techStack: [{ id: 1, name: "Frontend" }] })
    );

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