website refactor
This commit is contained in:
@@ -53,7 +53,7 @@ describe('SponsorController', () => {
|
||||
describe('getEntitySponsorshipPricing', () => {
|
||||
it('should return sponsorship pricing', async () => {
|
||||
const mockResult = { entityType: 'season', entityId: 'season-1', pricing: [] };
|
||||
sponsorService.getEntitySponsorshipPricing.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getEntitySponsorshipPricing.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getEntitySponsorshipPricing();
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('SponsorController', () => {
|
||||
describe('getSponsors', () => {
|
||||
it('should return sponsors list', async () => {
|
||||
const mockResult = { sponsors: [] };
|
||||
sponsorService.getSponsors.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getSponsors.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getSponsors();
|
||||
|
||||
@@ -78,9 +78,9 @@ describe('SponsorController', () => {
|
||||
it('should create sponsor', async () => {
|
||||
const input = { name: 'Test Sponsor', contactEmail: 'test@example.com' };
|
||||
const mockResult = { sponsor: { id: 's1', name: 'Test Sponsor' } };
|
||||
sponsorService.createSponsor.mockResolvedValue(mockResult as any);
|
||||
sponsorService.createSponsor.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.createSponsor(input as any);
|
||||
const result = await controller.createSponsor(input as never);
|
||||
|
||||
expect(result).toEqual(mockResult);
|
||||
expect(sponsorService.createSponsor).toHaveBeenCalledWith(input);
|
||||
@@ -90,8 +90,8 @@ describe('SponsorController', () => {
|
||||
describe('getSponsorDashboard', () => {
|
||||
it('should return sponsor dashboard', async () => {
|
||||
const sponsorId = 's1';
|
||||
const mockResult = { sponsorId, metrics: {} as any, sponsoredLeagues: [], investment: {} as any };
|
||||
sponsorService.getSponsorDashboard.mockResolvedValue(mockResult as any);
|
||||
const mockResult = { sponsorId, metrics: {} as never, sponsoredLeagues: [], investment: {} as never };
|
||||
sponsorService.getSponsorDashboard.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getSponsorDashboard(sponsorId);
|
||||
|
||||
@@ -122,7 +122,7 @@ describe('SponsorController', () => {
|
||||
currency: 'USD',
|
||||
},
|
||||
};
|
||||
sponsorService.getSponsorSponsorships.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getSponsorSponsorships.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getSponsorSponsorships(sponsorId);
|
||||
|
||||
@@ -142,7 +142,7 @@ describe('SponsorController', () => {
|
||||
it('should return sponsor', async () => {
|
||||
const sponsorId = 's1';
|
||||
const mockResult = { sponsor: { id: sponsorId, name: 'S1' } };
|
||||
sponsorService.getSponsor.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getSponsor.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getSponsor(sponsorId);
|
||||
|
||||
@@ -167,7 +167,7 @@ describe('SponsorController', () => {
|
||||
requests: [],
|
||||
totalCount: 0,
|
||||
};
|
||||
sponsorService.getPendingSponsorshipRequests.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getPendingSponsorshipRequests.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getPendingSponsorshipRequests(query);
|
||||
|
||||
@@ -188,9 +188,9 @@ describe('SponsorController', () => {
|
||||
platformFee: 10,
|
||||
netAmount: 90,
|
||||
};
|
||||
sponsorService.acceptSponsorshipRequest.mockResolvedValue(mockResult as any);
|
||||
sponsorService.acceptSponsorshipRequest.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.acceptSponsorshipRequest(requestId, input as any);
|
||||
const result = await controller.acceptSponsorshipRequest(requestId, input as never);
|
||||
|
||||
expect(result).toEqual(mockResult);
|
||||
expect(sponsorService.acceptSponsorshipRequest).toHaveBeenCalledWith(
|
||||
@@ -204,7 +204,7 @@ describe('SponsorController', () => {
|
||||
const input = { respondedBy: 'u1' };
|
||||
sponsorService.acceptSponsorshipRequest.mockRejectedValue(new Error('Accept sponsorship request failed'));
|
||||
|
||||
await expect(controller.acceptSponsorshipRequest(requestId, input as any)).rejects.toBeInstanceOf(Error);
|
||||
await expect(controller.acceptSponsorshipRequest(requestId, input as never)).rejects.toBeInstanceOf(Error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -218,9 +218,9 @@ describe('SponsorController', () => {
|
||||
rejectedAt: new Date(),
|
||||
reason: 'Not interested',
|
||||
};
|
||||
sponsorService.rejectSponsorshipRequest.mockResolvedValue(mockResult as any);
|
||||
sponsorService.rejectSponsorshipRequest.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.rejectSponsorshipRequest(requestId, input as any);
|
||||
const result = await controller.rejectSponsorshipRequest(requestId, input as never);
|
||||
|
||||
expect(result).toEqual(mockResult);
|
||||
expect(sponsorService.rejectSponsorshipRequest).toHaveBeenCalledWith(
|
||||
@@ -235,7 +235,7 @@ describe('SponsorController', () => {
|
||||
const input = { respondedBy: 'u1' };
|
||||
sponsorService.rejectSponsorshipRequest.mockRejectedValue(new Error('Reject sponsorship request failed'));
|
||||
|
||||
await expect(controller.rejectSponsorshipRequest(requestId, input as any)).rejects.toBeInstanceOf(Error);
|
||||
await expect(controller.rejectSponsorshipRequest(requestId, input as never)).rejects.toBeInstanceOf(Error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -254,7 +254,7 @@ describe('SponsorController', () => {
|
||||
averageMonthlySpend: 0,
|
||||
},
|
||||
};
|
||||
sponsorService.getSponsorBilling.mockResolvedValue(mockResult as any);
|
||||
sponsorService.getSponsorBilling.mockResolvedValue(mockResult as never);
|
||||
|
||||
const result = await controller.getSponsorBilling(sponsorId);
|
||||
|
||||
@@ -265,8 +265,8 @@ describe('SponsorController', () => {
|
||||
|
||||
describe('getAvailableLeagues', () => {
|
||||
it('should return available leagues', async () => {
|
||||
const mockResult: any[] = [];
|
||||
sponsorService.getAvailableLeagues.mockResolvedValue({ viewModel: mockResult } as any);
|
||||
const mockResult: unknown[] = [];
|
||||
sponsorService.getAvailableLeagues.mockResolvedValue({ viewModel: mockResult } as never);
|
||||
|
||||
const result = await controller.getAvailableLeagues();
|
||||
|
||||
@@ -279,11 +279,11 @@ describe('SponsorController', () => {
|
||||
it('should return league detail', async () => {
|
||||
const leagueId = 'league-1';
|
||||
const mockResult = {
|
||||
league: { id: leagueId } as any,
|
||||
league: { id: leagueId } as never,
|
||||
drivers: [],
|
||||
races: [],
|
||||
};
|
||||
sponsorService.getLeagueDetail.mockResolvedValue({ viewModel: mockResult } as any);
|
||||
sponsorService.getLeagueDetail.mockResolvedValue({ viewModel: mockResult } as never);
|
||||
|
||||
const result = await controller.getLeagueDetail(leagueId);
|
||||
|
||||
@@ -296,11 +296,11 @@ describe('SponsorController', () => {
|
||||
it('should return sponsor settings', async () => {
|
||||
const sponsorId = 's1';
|
||||
const mockResult = {
|
||||
profile: {} as any,
|
||||
notifications: {} as any,
|
||||
privacy: {} as any,
|
||||
profile: {} as never,
|
||||
notifications: {} as never,
|
||||
privacy: {} as never,
|
||||
};
|
||||
sponsorService.getSponsorSettings.mockResolvedValue({ viewModel: mockResult } as any);
|
||||
sponsorService.getSponsorSettings.mockResolvedValue({ viewModel: mockResult } as never);
|
||||
|
||||
const result = await controller.getSponsorSettings(sponsorId);
|
||||
|
||||
@@ -314,7 +314,7 @@ describe('SponsorController', () => {
|
||||
const sponsorId = 's1';
|
||||
const input = {};
|
||||
const mockResult = { success: true };
|
||||
sponsorService.updateSponsorSettings.mockResolvedValue({ viewModel: mockResult } as any);
|
||||
sponsorService.updateSponsorSettings.mockResolvedValue({ viewModel: mockResult } as never);
|
||||
|
||||
const result = await controller.updateSponsorSettings(sponsorId, input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user