import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { {{camelCase name}}Container } from "./container";
import { {{constantCase name}}_SYMBOLS } from "./symbols";
import { {{pascalCase name}}Module } from "./module";
import { Mock{{pascalCase entity}}Repository } from "@/infrastructure/repositories/{{kebabCase entity}}.repository.mock";
import type { I{{pascalCase entity}}Repository } from "@/application/repositories/{{kebabCase entity}}.repository.interface";
import type { IGet{{pascalCase entity}}UseCase } from "@/application/use-cases/get-{{kebabCase entity}}.use-case";
import type { IGet{{pascalCase entity}}Controller } from "@/interface-adapters/controllers/get-{{kebabCase entity}}.controller";

describe("{{camelCase name}}Container", () => {
  beforeEach(() => {
    {{camelCase name}}Container.unbindAll();
    {{camelCase name}}Container.load({{pascalCase name}}Module);
  });

  afterEach(() => {
    {{camelCase name}}Container.unbindAll();
  });

  it("resolves I{{pascalCase entity}}Repository to Mock{{pascalCase entity}}Repository", () => {
    const repo = {{camelCase name}}Container.get<I{{pascalCase entity}}Repository>(
      {{constantCase name}}_SYMBOLS.I{{pascalCase entity}}Repository,
    );
    expect(repo).toBeInstanceOf(Mock{{pascalCase entity}}Repository);
  });

  it("resolves IGet{{pascalCase entity}}UseCase as a function", () => {
    const useCase = {{camelCase name}}Container.get<IGet{{pascalCase entity}}UseCase>(
      {{constantCase name}}_SYMBOLS.IGet{{pascalCase entity}}UseCase,
    );
    expect(typeof useCase).toBe("function");
  });

  it("resolves IGet{{pascalCase entity}}Controller as a function", () => {
    const controller = {{camelCase name}}Container.get<IGet{{pascalCase entity}}Controller>(
      {{constantCase name}}_SYMBOLS.IGet{{pascalCase entity}}Controller,
    );
    expect(typeof controller).toBe("function");
  });
});
