import { Test, TestingModule } from '@nestjs/testing';
import { GuestsService } from './guests.service';
import {getModelToken} from "@nestjs/mongoose";
import {Guest} from "../schemas/guest.schema";
import {Model} from "mongoose";
import {Config} from "../schemas/config.schema";
import {ClientProxy} from "@nestjs/microservices";
import {ClientProxyMock} from "../mocks/client-proxy.mock";
import {CommandBus, EventBus, QueryBus} from "@nestjs/cqrs";
import {EventbusMock} from "../mocks/eventbus.mock";
import {CommandbusMock} from "../mocks/commandbus.mock";
import {CardsServiceMock} from "../mocks/cards-service.mock";
import {CardsService} from "../cards/cards.service";
import {ConfigService} from "@nestjs/config";
import {ConfigServiceMock} from "../mocks/config-service.mock";
import {QueryBusMock} from "../mocks/querybus.mock";
import {VoiceService} from "../voice/voice.service";
import {VoiceServiceMock} from "../mocks/voice-service.mock";

describe('GuestsService', () => {
  let service: GuestsService;

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [
        GuestsService,
        { provide: getModelToken(Guest.name), useValue: Model },
        { provide: getModelToken(Config.name), useValue: Model },
        { provide: 'Telegram', useValue: ClientProxyMock },
        { provide: EventBus, useValue: EventbusMock },
        { provide: CommandBus, useValue: CommandbusMock },
        { provide: CardsService, useValue: CardsServiceMock },
        { provide: ConfigService, useValue: ConfigServiceMock },
        { provide: QueryBus, useValue: QueryBusMock },
        { provide: VoiceService, useValue: VoiceServiceMock },
      ],
    }).compile();

    service = module.get<GuestsService>(GuestsService);
  });

  it('should be defined', () => {
    expect(service).toBeDefined();
  });
});
