integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
57
tests/integration/dashboard/DashboardTestContext.ts
Normal file
57
tests/integration/dashboard/DashboardTestContext.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { vi } from 'vitest';
|
||||
import { InMemoryDriverRepository } from '../../../adapters/drivers/persistence/inmemory/InMemoryDriverRepository';
|
||||
import { InMemoryRaceRepository } from '../../../adapters/races/persistence/inmemory/InMemoryRaceRepository';
|
||||
import { InMemoryLeagueRepository } from '../../../adapters/leagues/persistence/inmemory/InMemoryLeagueRepository';
|
||||
import { InMemoryActivityRepository } from '../../../adapters/activity/persistence/inmemory/InMemoryActivityRepository';
|
||||
import { InMemoryEventPublisher } from '../../../adapters/events/InMemoryEventPublisher';
|
||||
import { GetDashboardUseCase } from '../../../core/dashboard/application/use-cases/GetDashboardUseCase';
|
||||
import { DashboardPresenter } from '../../../core/dashboard/application/presenters/DashboardPresenter';
|
||||
import { DashboardRepository } from '../../../core/dashboard/application/ports/DashboardRepository';
|
||||
|
||||
export class DashboardTestContext {
|
||||
public readonly driverRepository: InMemoryDriverRepository;
|
||||
public readonly raceRepository: InMemoryRaceRepository;
|
||||
public readonly leagueRepository: InMemoryLeagueRepository;
|
||||
public readonly activityRepository: InMemoryActivityRepository;
|
||||
public readonly eventPublisher: InMemoryEventPublisher;
|
||||
public readonly getDashboardUseCase: GetDashboardUseCase;
|
||||
public readonly dashboardPresenter: DashboardPresenter;
|
||||
public readonly loggerMock: any;
|
||||
|
||||
constructor() {
|
||||
this.driverRepository = new InMemoryDriverRepository();
|
||||
this.raceRepository = new InMemoryRaceRepository();
|
||||
this.leagueRepository = new InMemoryLeagueRepository();
|
||||
this.activityRepository = new InMemoryActivityRepository();
|
||||
this.eventPublisher = new InMemoryEventPublisher();
|
||||
this.dashboardPresenter = new DashboardPresenter();
|
||||
this.loggerMock = {
|
||||
debug: vi.fn(),
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
};
|
||||
|
||||
this.getDashboardUseCase = new GetDashboardUseCase({
|
||||
driverRepository: this.driverRepository,
|
||||
raceRepository: this.raceRepository as unknown as DashboardRepository,
|
||||
leagueRepository: this.leagueRepository as unknown as DashboardRepository,
|
||||
activityRepository: this.activityRepository as unknown as DashboardRepository,
|
||||
eventPublisher: this.eventPublisher,
|
||||
logger: this.loggerMock,
|
||||
});
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this.driverRepository.clear();
|
||||
this.raceRepository.clear();
|
||||
this.leagueRepository.clear();
|
||||
this.activityRepository.clear();
|
||||
this.eventPublisher.clear();
|
||||
vi.clearAllMocks();
|
||||
}
|
||||
|
||||
public static create(): DashboardTestContext {
|
||||
return new DashboardTestContext();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user