refactor api modules
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { GetEntitySponsorshipPricingPresenter } from './GetEntitySponsorshipPricingPresenter';
|
||||
import type { GetEntitySponsorshipPricingResult } from '@core/racing/application/use-cases/GetEntitySponsorshipPricingUseCase';
|
||||
|
||||
describe('GetEntitySponsorshipPricingPresenter', () => {
|
||||
let presenter: GetEntitySponsorshipPricingPresenter;
|
||||
@@ -10,9 +11,20 @@ describe('GetEntitySponsorshipPricingPresenter', () => {
|
||||
|
||||
describe('reset', () => {
|
||||
it('should reset the result to null', () => {
|
||||
const mockResult = { entityType: 'season', entityId: 'season-1', pricing: [] };
|
||||
const mockResult: GetEntitySponsorshipPricingResult = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
acceptingApplications: true,
|
||||
tiers: []
|
||||
};
|
||||
presenter.present(mockResult);
|
||||
expect(presenter.viewModel).toEqual(mockResult);
|
||||
|
||||
const expectedViewModel = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
pricing: []
|
||||
};
|
||||
expect(presenter.viewModel).toEqual(expectedViewModel);
|
||||
|
||||
presenter.reset();
|
||||
expect(() => presenter.viewModel).toThrow('Presenter not presented');
|
||||
@@ -21,11 +33,21 @@ describe('GetEntitySponsorshipPricingPresenter', () => {
|
||||
|
||||
describe('present', () => {
|
||||
it('should store the result', () => {
|
||||
const mockResult = { entityType: 'season', entityId: 'season-1', pricing: [] };
|
||||
const mockResult: GetEntitySponsorshipPricingResult = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
acceptingApplications: true,
|
||||
tiers: []
|
||||
};
|
||||
|
||||
presenter.present(mockResult);
|
||||
|
||||
expect(presenter.viewModel).toEqual(mockResult);
|
||||
const expectedViewModel = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
pricing: []
|
||||
};
|
||||
expect(presenter.viewModel).toEqual(expectedViewModel);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,10 +57,20 @@ describe('GetEntitySponsorshipPricingPresenter', () => {
|
||||
});
|
||||
|
||||
it('should return the result when presented', () => {
|
||||
const mockResult = { entityType: 'season', entityId: 'season-1', pricing: [] };
|
||||
const mockResult: GetEntitySponsorshipPricingResult = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
acceptingApplications: true,
|
||||
tiers: []
|
||||
};
|
||||
presenter.present(mockResult);
|
||||
|
||||
expect(presenter.getViewModel()).toEqual(mockResult);
|
||||
const expectedViewModel = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
pricing: []
|
||||
};
|
||||
expect(presenter.getViewModel()).toEqual(expectedViewModel);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,10 +80,20 @@ describe('GetEntitySponsorshipPricingPresenter', () => {
|
||||
});
|
||||
|
||||
it('should return the result when presented', () => {
|
||||
const mockResult = { entityType: 'season', entityId: 'season-1', pricing: [] };
|
||||
const mockResult: GetEntitySponsorshipPricingResult = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
acceptingApplications: true,
|
||||
tiers: []
|
||||
};
|
||||
presenter.present(mockResult);
|
||||
|
||||
expect(presenter.viewModel).toEqual(mockResult);
|
||||
const expectedViewModel = {
|
||||
entityType: 'season',
|
||||
entityId: 'season-1',
|
||||
pricing: []
|
||||
};
|
||||
expect(presenter.viewModel).toEqual(expectedViewModel);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user