import { Test, TestingModule } from '@nestjs/testing';
import { DashboardModule } from './DashboardModule';
import { DashboardController } from './DashboardController';
import { DashboardService } from './DashboardService';
import { DashboardOverviewPresenter } from './presenters/DashboardOverviewPresenter';
import { DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN } from './DashboardProviders';

describe('DashboardModule', () => {
  let module: TestingModule;

  beforeEach(async () => {
    module = await Test.createTestingModule({
      imports: [DashboardModule],
    }).compile();
  });

  it('should compile the module', () => {
    expect(module).toBeDefined();
  });

  it('should provide DashboardController', () => {
    const controller = module.get<DashboardController>(DashboardController);
    expect(controller).toBeDefined();
    expect(controller).toBeInstanceOf(DashboardController);
  });

  it('should provide DashboardService', () => {
    const service = module.get<DashboardService>(DashboardService);
    expect(service).toBeDefined();
    expect(service).toBeInstanceOf(DashboardService);
  });

  it('should bind DashboardOverviewPresenter as the output port for the use case', () => {
    const presenter = module.get<DashboardOverviewPresenter>(DASHBOARD_OVERVIEW_OUTPUT_PORT_TOKEN);
    expect(presenter).toBeDefined();
    expect(presenter).toBeInstanceOf(DashboardOverviewPresenter);
  });
});