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:
@@ -0,0 +1,64 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { GetEntitySponsorshipPricingUseCase } from '../../../../core/racing/application/use-cases/GetEntitySponsorshipPricingUseCase';
|
||||
import { SponsorTestContext } from '../SponsorTestContext';
|
||||
|
||||
describe('Sponsor League Detail Use Case Orchestration', () => {
|
||||
let context: SponsorTestContext;
|
||||
let getEntitySponsorshipPricingUseCase: GetEntitySponsorshipPricingUseCase;
|
||||
|
||||
beforeEach(() => {
|
||||
context = new SponsorTestContext();
|
||||
getEntitySponsorshipPricingUseCase = new GetEntitySponsorshipPricingUseCase(
|
||||
context.sponsorshipPricingRepository,
|
||||
context.logger,
|
||||
);
|
||||
});
|
||||
|
||||
describe('GetEntitySponsorshipPricingUseCase - Success Path', () => {
|
||||
it('should retrieve sponsorship pricing for a league', async () => {
|
||||
const leagueId = 'league-123';
|
||||
const pricing = {
|
||||
entityType: 'league' as const,
|
||||
entityId: leagueId,
|
||||
acceptingApplications: true,
|
||||
mainSlot: {
|
||||
price: { amount: 10000, currency: 'USD' },
|
||||
benefits: ['Primary logo placement', 'League page header banner'],
|
||||
},
|
||||
secondarySlots: {
|
||||
price: { amount: 2000, currency: 'USD' },
|
||||
benefits: ['Secondary logo on liveries', 'League page sidebar placement'],
|
||||
},
|
||||
};
|
||||
await context.sponsorshipPricingRepository.create(pricing);
|
||||
|
||||
const result = await getEntitySponsorshipPricingUseCase.execute({
|
||||
entityType: 'league',
|
||||
entityId: leagueId,
|
||||
});
|
||||
|
||||
expect(result.isOk()).toBe(true);
|
||||
const pricingResult = result.unwrap();
|
||||
|
||||
expect(pricingResult.entityType).toBe('league');
|
||||
expect(pricingResult.entityId).toBe(leagueId);
|
||||
expect(pricingResult.acceptingApplications).toBe(true);
|
||||
expect(pricingResult.tiers).toHaveLength(2);
|
||||
expect(pricingResult.tiers[0].name).toBe('main');
|
||||
expect(pricingResult.tiers[0].price.amount).toBe(10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('GetEntitySponsorshipPricingUseCase - Error Handling', () => {
|
||||
it('should return error when pricing is not configured', async () => {
|
||||
const result = await getEntitySponsorshipPricingUseCase.execute({
|
||||
entityType: 'league',
|
||||
entityId: 'non-existent',
|
||||
});
|
||||
|
||||
expect(result.isErr()).toBe(true);
|
||||
const error = result.unwrapErr();
|
||||
expect(error.code).toBe('PRICING_NOT_CONFIGURED');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user