This commit is contained in:
2025-11-30 23:00:48 +01:00
parent 4b8c70978f
commit 645f537895
41 changed files with 738 additions and 1631 deletions

View File

@@ -31,7 +31,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
const state = CheckoutState.ready();
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
vi.mocked(mockConfirmationPort.requestCheckoutConfirmation).mockResolvedValue(
@@ -60,7 +60,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
const state = CheckoutState.ready();
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
vi.mocked(mockConfirmationPort.requestCheckoutConfirmation).mockResolvedValue(
@@ -80,7 +80,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
const state = CheckoutState.ready();
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
vi.mocked(mockConfirmationPort.requestCheckoutConfirmation).mockResolvedValue(
@@ -100,7 +100,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
const state = CheckoutState.ready();
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
vi.mocked(mockConfirmationPort.requestCheckoutConfirmation).mockResolvedValue(
@@ -118,7 +118,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
const state = CheckoutState.insufficientFunds();
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
const result = await useCase.execute();
@@ -139,7 +139,7 @@ describe('ConfirmCheckoutUseCase - Enhanced with Confirmation Port', () => {
};
vi.mocked(mockCheckoutService.extractCheckoutInfo).mockResolvedValue(
Result.ok({ price, state })
Result.ok({ price, state, buttonHtml: '' })
);
vi.mocked(mockConfirmationPort.requestCheckoutConfirmation).mockResolvedValue(

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeEach, Mock } from 'vitest';
import { StartAutomationSessionUseCase } from '../../../../packages/application/use-cases/StartAutomationSessionUseCase';
import { IAutomationEngine } from '../../../../packages/application/ports/IAutomationEngine';
import { IBrowserAutomation } from '../../../../packages/application/ports/IBrowserAutomation';
import { IScreenAutomation } from '../../../../packages/application/ports/IScreenAutomation';
import { ISessionRepository } from '../../../../packages/application/ports/ISessionRepository';
import { AutomationSession } from '../../../../packages/domain/entities/AutomationSession';
@@ -48,7 +48,7 @@ describe('StartAutomationSessionUseCase', () => {
useCase = new StartAutomationSessionUseCase(
mockAutomationEngine as unknown as IAutomationEngine,
mockBrowserAutomation as unknown as IBrowserAutomation,
mockBrowserAutomation as unknown as IScreenAutomation,
mockSessionRepository as unknown as ISessionRepository
);
});

View File

@@ -60,7 +60,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
const result = cookieStore.validateCookieConfiguration(targetUrl);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toMatch(/domain mismatch/i);
expect(result.unwrapErr().message).toMatch(/domain mismatch/i);
});
test('should fail when cookie path is invalid for target', async () => {
@@ -81,7 +81,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
const result = cookieStore.validateCookieConfiguration(targetUrl);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toMatch(/path.*not valid/i);
expect(result.unwrapErr().message).toMatch(/path.*not valid/i);
});
test('should fail when required irsso_members cookie is missing', async () => {
@@ -102,7 +102,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
const result = cookieStore.validateCookieConfiguration(targetUrl);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toMatch(/required.*irsso_members/i);
expect(result.unwrapErr().message).toMatch(/required.*irsso_members/i);
});
test('should fail when required authtoken_members cookie is missing', async () => {
@@ -123,14 +123,14 @@ describe('SessionCookieStore - Cookie Validation', () => {
const result = cookieStore.validateCookieConfiguration(targetUrl);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toMatch(/required.*authtoken_members/i);
expect(result.unwrapErr().message).toMatch(/required.*authtoken_members/i);
});
test('should fail when no cookies are stored', () => {
const result = cookieStore.validateCookieConfiguration(targetUrl);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toMatch(/no cookies/i);
expect(result.unwrapErr().message).toMatch(/no cookies/i);
});
test('should validate cookies for members-ng.iracing.com domain', async () => {