Refactor infra tests, clean E2E step suites, and fix TS in tests
This commit is contained in:
@@ -24,9 +24,9 @@ describe('CompleteRaceCreationUseCase', () => {
|
||||
const price = CheckoutPrice.fromString('$25.50');
|
||||
const state = CheckoutState.ready();
|
||||
const sessionId = 'test-session-123';
|
||||
|
||||
|
||||
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
|
||||
Result.ok({ price, state })
|
||||
Result.ok({ price, state, buttonHtml: '<a>$25.50</a>' })
|
||||
);
|
||||
|
||||
const result = await useCase.execute(sessionId);
|
||||
@@ -54,9 +54,9 @@ describe('CompleteRaceCreationUseCase', () => {
|
||||
|
||||
it('should return error if price is missing', async () => {
|
||||
const state = CheckoutState.ready();
|
||||
|
||||
|
||||
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
|
||||
Result.ok({ price: undefined as any, state })
|
||||
Result.ok({ price: undefined as any, state, buttonHtml: '<a>n/a</a>' })
|
||||
);
|
||||
|
||||
const result = await useCase.execute('test-session-123');
|
||||
@@ -78,13 +78,13 @@ describe('CompleteRaceCreationUseCase', () => {
|
||||
{ input: '$100.50', expected: '$100.50' },
|
||||
{ input: '$0.99', expected: '$0.99' },
|
||||
];
|
||||
|
||||
|
||||
for (const testCase of testCases) {
|
||||
const price = CheckoutPrice.fromString(testCase.input);
|
||||
const state = CheckoutState.ready();
|
||||
|
||||
|
||||
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
|
||||
Result.ok({ price, state })
|
||||
Result.ok({ price, state, buttonHtml: `<a>${testCase.input}</a>` })
|
||||
);
|
||||
|
||||
const result = await useCase.execute('test-session');
|
||||
@@ -99,9 +99,9 @@ describe('CompleteRaceCreationUseCase', () => {
|
||||
const price = CheckoutPrice.fromString('$25.50');
|
||||
const state = CheckoutState.ready();
|
||||
const beforeExecution = new Date();
|
||||
|
||||
|
||||
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
|
||||
Result.ok({ price, state })
|
||||
Result.ok({ price, state, buttonHtml: '<a>$25.50</a>' })
|
||||
);
|
||||
|
||||
const result = await useCase.execute('test-session');
|
||||
|
||||
Reference in New Issue
Block a user