Refactor infra tests, clean E2E step suites, and fix TS in tests

This commit is contained in:
2025-11-30 10:58:49 +01:00
parent af14526ae2
commit f8a1fbeb50
43 changed files with 883 additions and 2159 deletions

View File

@@ -23,7 +23,7 @@ describe('ConfirmCheckoutUseCase', () => {
requestCheckoutConfirmation: Mock;
};
let mockPrice: CheckoutPrice;
beforeEach(() => {
mockCheckoutService = {
extractCheckoutInfo: vi.fn(),
@@ -33,12 +33,12 @@ describe('ConfirmCheckoutUseCase', () => {
mockConfirmationPort = {
requestCheckoutConfirmation: vi.fn(),
};
mockPrice = {
getAmount: vi.fn(() => 0.50),
toDisplayString: vi.fn(() => '$0.50'),
isZero: vi.fn(() => false),
};
} as unknown as CheckoutPrice;
});
describe('Success flow', () => {
@@ -230,11 +230,11 @@ describe('ConfirmCheckoutUseCase', () => {
describe('Zero price warning', () => {
it('should still require confirmation for $0.00 price', async () => {
const zeroPriceMock: CheckoutPrice = {
const zeroPriceMock = {
getAmount: vi.fn(() => 0.00),
toDisplayString: vi.fn(() => '$0.00'),
isZero: vi.fn(() => true),
};
} as unknown as CheckoutPrice;
const useCase = new ConfirmCheckoutUseCase(
mockCheckoutService as unknown as ICheckoutService,
@@ -263,11 +263,11 @@ describe('ConfirmCheckoutUseCase', () => {
});
it('should proceed with checkout for zero price after confirmation', async () => {
const zeroPriceMock: CheckoutPrice = {
const zeroPriceMock = {
getAmount: vi.fn(() => 0.00),
toDisplayString: vi.fn(() => '$0.00'),
isZero: vi.fn(() => true),
};
} as unknown as CheckoutPrice;
const useCase = new ConfirmCheckoutUseCase(
mockCheckoutService as unknown as ICheckoutService,