integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m50s
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 4m50s
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:
@@ -89,6 +89,10 @@ export class InMemoryEventPublisher implements DashboardEventPublisher, LeagueEv
|
||||
return [...this.leagueRosterAccessedEvents];
|
||||
}
|
||||
|
||||
getLeagueCreatedEvents(): LeagueCreatedEvent[] {
|
||||
return [...this.leagueCreatedEvents];
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.dashboardAccessedEvents = [];
|
||||
this.dashboardErrorEvents = [];
|
||||
|
||||
@@ -213,22 +213,43 @@ export class InMemoryLeagueRepository implements LeagueRepository {
|
||||
return this.leagueStandings.get(driverId) || [];
|
||||
}
|
||||
|
||||
addLeagueMembers(leagueId: string, members: LeagueMember[]): void {
|
||||
this.leagueMembers.set(leagueId, members);
|
||||
async addLeagueMembers(leagueId: string, members: LeagueMember[]): Promise<void> {
|
||||
const current = this.leagueMembers.get(leagueId) || [];
|
||||
this.leagueMembers.set(leagueId, [...current, ...members]);
|
||||
}
|
||||
|
||||
async getLeagueMembers(leagueId: string): Promise<LeagueMember[]> {
|
||||
return this.leagueMembers.get(leagueId) || [];
|
||||
}
|
||||
|
||||
addPendingRequests(leagueId: string, requests: LeaguePendingRequest[]): void {
|
||||
this.leaguePendingRequests.set(leagueId, requests);
|
||||
async updateLeagueMember(leagueId: string, driverId: string, updates: Partial<LeagueMember>): Promise<void> {
|
||||
const members = this.leagueMembers.get(leagueId) || [];
|
||||
const index = members.findIndex(m => m.driverId === driverId);
|
||||
if (index !== -1) {
|
||||
members[index] = { ...members[index], ...updates } as LeagueMember;
|
||||
this.leagueMembers.set(leagueId, [...members]);
|
||||
}
|
||||
}
|
||||
|
||||
async removeLeagueMember(leagueId: string, driverId: string): Promise<void> {
|
||||
const members = this.leagueMembers.get(leagueId) || [];
|
||||
this.leagueMembers.set(leagueId, members.filter(m => m.driverId !== driverId));
|
||||
}
|
||||
|
||||
async addPendingRequests(leagueId: string, requests: LeaguePendingRequest[]): Promise<void> {
|
||||
const current = this.leaguePendingRequests.get(leagueId) || [];
|
||||
this.leaguePendingRequests.set(leagueId, [...current, ...requests]);
|
||||
}
|
||||
|
||||
async getPendingRequests(leagueId: string): Promise<LeaguePendingRequest[]> {
|
||||
return this.leaguePendingRequests.get(leagueId) || [];
|
||||
}
|
||||
|
||||
async removePendingRequest(leagueId: string, requestId: string): Promise<void> {
|
||||
const current = this.leaguePendingRequests.get(leagueId) || [];
|
||||
this.leaguePendingRequests.set(leagueId, current.filter(r => r.id !== requestId));
|
||||
}
|
||||
|
||||
private createDefaultStats(leagueId: string): LeagueStats {
|
||||
return {
|
||||
leagueId,
|
||||
|
||||
@@ -18,6 +18,12 @@ export class InMemoryAvatarGenerationRepository implements AvatarGenerationRepos
|
||||
}
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.requests.clear();
|
||||
this.userRequests.clear();
|
||||
this.logger.info('InMemoryAvatarGenerationRepository cleared.');
|
||||
}
|
||||
|
||||
async save(request: AvatarGenerationRequest): Promise<void> {
|
||||
this.logger.debug(`[InMemoryAvatarGenerationRepository] Saving avatar generation request: ${request.id} for user ${request.userId}.`);
|
||||
this.requests.set(request.id, request);
|
||||
|
||||
22
adapters/media/ports/InMemoryAvatarGenerationAdapter.ts
Normal file
22
adapters/media/ports/InMemoryAvatarGenerationAdapter.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { AvatarGenerationPort, AvatarGenerationOptions, AvatarGenerationResult } from '@core/media/application/ports/AvatarGenerationPort';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
|
||||
export class InMemoryAvatarGenerationAdapter implements AvatarGenerationPort {
|
||||
constructor(private readonly logger: Logger) {
|
||||
this.logger.info('InMemoryAvatarGenerationAdapter initialized.');
|
||||
}
|
||||
|
||||
async generateAvatars(options: AvatarGenerationOptions): Promise<AvatarGenerationResult> {
|
||||
this.logger.debug('[InMemoryAvatarGenerationAdapter] Generating avatars (mock).', { options });
|
||||
|
||||
const avatars = Array.from({ length: options.count }, (_, i) => ({
|
||||
url: `https://example.com/generated-avatar-${i + 1}.png`,
|
||||
thumbnailUrl: `https://example.com/generated-avatar-${i + 1}-thumb.png`,
|
||||
}));
|
||||
|
||||
return Promise.resolve({
|
||||
success: true,
|
||||
avatars,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export class InMemoryMediaStorageAdapter implements MediaStoragePort {
|
||||
}
|
||||
|
||||
// Generate storage key
|
||||
const storageKey = `uploaded/${Date.now()}-${options.filename.replace(/[^a-zA-Z0-9.-]/g, '_')}`;
|
||||
const storageKey = `/media/uploaded/${Date.now()}-${options.filename.replace(/[^a-zA-Z0-9.-]/g, '_')}`;
|
||||
|
||||
// Store buffer and metadata
|
||||
this.storage.set(storageKey, buffer);
|
||||
|
||||
@@ -6,34 +6,33 @@ import type { Payment, PaymentType } from '@core/payments/domain/entities/Paymen
|
||||
import type { PaymentRepository } from '@core/payments/domain/repositories/PaymentRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
|
||||
const payments: Map<string, Payment> = new Map();
|
||||
|
||||
export class InMemoryPaymentRepository implements PaymentRepository {
|
||||
private payments: Map<string, Payment> = new Map();
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<Payment | null> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] findById', { id });
|
||||
return payments.get(id) || null;
|
||||
return this.payments.get(id) || null;
|
||||
}
|
||||
|
||||
async findByLeagueId(leagueId: string): Promise<Payment[]> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] findByLeagueId', { leagueId });
|
||||
return Array.from(payments.values()).filter(p => p.leagueId === leagueId);
|
||||
return Array.from(this.payments.values()).filter(p => p.leagueId === leagueId);
|
||||
}
|
||||
|
||||
async findByPayerId(payerId: string): Promise<Payment[]> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] findByPayerId', { payerId });
|
||||
return Array.from(payments.values()).filter(p => p.payerId === payerId);
|
||||
return Array.from(this.payments.values()).filter(p => p.payerId === payerId);
|
||||
}
|
||||
|
||||
async findByType(type: PaymentType): Promise<Payment[]> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] findByType', { type });
|
||||
return Array.from(payments.values()).filter(p => p.type === type);
|
||||
return Array.from(this.payments.values()).filter(p => p.type === type);
|
||||
}
|
||||
|
||||
async findByFilters(filters: { leagueId?: string; payerId?: string; type?: PaymentType }): Promise<Payment[]> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] findByFilters', { filters });
|
||||
let results = Array.from(payments.values());
|
||||
let results = Array.from(this.payments.values());
|
||||
|
||||
if (filters.leagueId) {
|
||||
results = results.filter(p => p.leagueId === filters.leagueId);
|
||||
@@ -50,13 +49,17 @@ export class InMemoryPaymentRepository implements PaymentRepository {
|
||||
|
||||
async create(payment: Payment): Promise<Payment> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] create', { payment });
|
||||
payments.set(payment.id, payment);
|
||||
this.payments.set(payment.id, payment);
|
||||
return payment;
|
||||
}
|
||||
|
||||
async update(payment: Payment): Promise<Payment> {
|
||||
this.logger.debug('[InMemoryPaymentRepository] update', { payment });
|
||||
payments.set(payment.id, payment);
|
||||
this.payments.set(payment.id, payment);
|
||||
return payment;
|
||||
}
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.payments.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,15 @@ export class InMemoryResultRepository implements ResultRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async clear(): Promise<void> {
|
||||
this.logger.debug('[InMemoryResultRepository] Clearing all results.');
|
||||
this.results.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to generate a new UUID
|
||||
*/
|
||||
static generateId(): string {
|
||||
return uuidv4();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +99,12 @@ export class InMemorySponsorshipPricingRepository implements SponsorshipPricingR
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async create(pricing: any): Promise<void> {
|
||||
await this.save(pricing.entityType, pricing.entityId, pricing);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.pricings.clear();
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,11 @@ export class InMemoryStandingRepository implements StandingRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async clear(): Promise<void> {
|
||||
this.logger.debug('Clearing all standings.');
|
||||
this.standings.clear();
|
||||
}
|
||||
|
||||
async recalculate(leagueId: string): Promise<Standing[]> {
|
||||
this.logger.debug(`Recalculating standings for league id: ${leagueId}`);
|
||||
try {
|
||||
@@ -268,4 +273,4 @@ export class InMemoryStandingRepository implements StandingRepository {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user