import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { marketingPagesContainer } from "./container";
import { MARKETING_PAGES_SYMBOLS } from "./symbols";
import { MarketingPagesModule } from "./module";
import { MockPagesRepository } from "@/infrastructure/repositories/pages.repository.mock";
import { MockSiteSettingsRepository } from "@/infrastructure/repositories/site-settings.repository.mock";
import type { IPagesRepository } from "@/application/repositories/pages.repository.interface";
import type { ISiteSettingsRepository } from "@/application/repositories/site-settings.repository.interface";

describe("marketingPagesContainer", () => {
  beforeEach(() => {
    marketingPagesContainer.unbindAll();
    marketingPagesContainer.load(MarketingPagesModule);
  });

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

  it("resolves IPagesRepository to MockPagesRepository", () => {
    const repo = marketingPagesContainer.get<IPagesRepository>(
      MARKETING_PAGES_SYMBOLS.IPagesRepository,
    );
    expect(repo).toBeInstanceOf(MockPagesRepository);
  });

  it("resolves ISiteSettingsRepository to MockSiteSettingsRepository", () => {
    const repo = marketingPagesContainer.get<ISiteSettingsRepository>(
      MARKETING_PAGES_SYMBOLS.ISiteSettingsRepository,
    );
    expect(repo).toBeInstanceOf(MockSiteSettingsRepository);
  });
});
