import { Test, TestingModule } from '@nestjs/testing';
import { GameService } from './game.service';
import {CommandBus, EventBus, QueryBus} from "@nestjs/cqrs";
import {CommandbusMock} from "../mocks/commandbus.mock";
import {EventbusMock} from "../mocks/eventbus.mock";
import {getModelToken} from "@nestjs/mongoose";
import {GameQueue} from "../schemas/game-queue.schema";
import {Model} from "mongoose";
import {ConfigService} from "@nestjs/config";
import {ConfigServiceMock} from "../mocks/config-service.mock";
import {SharedService} from "../shared/shared.service";
import {SharedServiceMock} from "../mocks/shared-service.mock";
import {QueryBusMock} from "../mocks/querybus.mock";
import {Guest} from "../schemas/guest.schema";
import {GuestsService} from "../guests/guests.service";
import {GuestsServiceMock} from "../mocks/guests-service.mock";

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

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [
        GameService,
        { provide: CommandBus, useValue: CommandbusMock },
        { provide: EventBus, useValue: EventbusMock },
        { provide: getModelToken(GameQueue.name), useValue: Model },
        { provide: ConfigService, useValue: ConfigServiceMock },
        { provide: SharedService, useValue: SharedServiceMock },
        { provide: QueryBus, useValue: QueryBusMock },
        { provide: GuestsService, useValue: GuestsServiceMock }
      ],
    }).compile();

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

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