import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { navigationContainer } from "./container";
import { NAVIGATION_SYMBOLS } from "./symbols";
import { NavigationModule } from "./module";
import { MockHeaderRepository } from "@/infrastructure/repositories/header.repository.mock";
import type { IHeaderRepository } from "@/application/repositories/header.repository.interface";
import type { IGetHeaderUseCase } from "@/application/use-cases/get-header.use-case";
import type { IGetHeaderController } from "@/interface-adapters/controllers/get-header.controller";

describe("navigationContainer", () => {
  beforeEach(() => {
    navigationContainer.unbindAll();
    navigationContainer.load(NavigationModule);
  });

  afterEach(() => {
    navigationContainer.unbindAll();
  });

  it("resolves IHeaderRepository to MockHeaderRepository", () => {
    const repo = navigationContainer.get<IHeaderRepository>(
      NAVIGATION_SYMBOLS.IHeaderRepository,
    );
    expect(repo).toBeInstanceOf(MockHeaderRepository);
  });

  it("resolves IGetHeaderUseCase as a function", () => {
    const useCase = navigationContainer.get<IGetHeaderUseCase>(
      NAVIGATION_SYMBOLS.IGetHeaderUseCase,
    );
    expect(typeof useCase).toBe("function");
  });

  it("resolves IGetHeaderController as a function", () => {
    const controller = navigationContainer.get<IGetHeaderController>(
      NAVIGATION_SYMBOLS.IGetHeaderController,
    );
    expect(typeof controller).toBe("function");
  });
});
