This commit is contained in:
2025-12-11 21:06:25 +01:00
parent c49ea2598d
commit ec3ddc3a5c
227 changed files with 3496 additions and 2083 deletions

View File

@@ -233,13 +233,13 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn().mockResolvedValue(
mockAuthService.verifyPageAuthentication = vi.fn().mockResolvedValue(
Result.ok(new BrowserAuthenticationState(true, true))
);
await useCase.execute({ verifyPageContent: true });
expect((mockAuthService as any).verifyPageAuthentication).toHaveBeenCalledTimes(1);
expect(mockAuthService.verifyPageAuthentication).toHaveBeenCalledTimes(1);
});
it('should return EXPIRED when cookies valid but page shows login UI', async () => {
@@ -253,7 +253,7 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn().mockResolvedValue(
mockAuthService.verifyPageAuthentication = vi.fn().mockResolvedValue(
Result.ok(new BrowserAuthenticationState(true, false))
);
@@ -274,7 +274,7 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn().mockResolvedValue(
mockAuthService.verifyPageAuthentication = vi.fn().mockResolvedValue(
Result.ok(new BrowserAuthenticationState(true, true))
);
@@ -295,11 +295,11 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn();
mockAuthService.verifyPageAuthentication = vi.fn();
await useCase.execute();
expect((mockAuthService as any).verifyPageAuthentication).not.toHaveBeenCalled();
expect(mockAuthService.verifyPageAuthentication).not.toHaveBeenCalled();
});
it('should handle verifyPageAuthentication errors gracefully', async () => {
@@ -313,7 +313,7 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn().mockResolvedValue(
mockAuthService.verifyPageAuthentication = vi.fn().mockResolvedValue(
Result.err('Page navigation failed')
);
@@ -388,7 +388,7 @@ describe('CheckAuthenticationUseCase', () => {
mockAuthService.getSessionExpiry.mockResolvedValue(
Result.ok(new Date(Date.now() + 3600000))
);
(mockAuthService as any).verifyPageAuthentication = vi.fn().mockResolvedValue(
mockAuthService.verifyPageAuthentication = vi.fn().mockResolvedValue(
Result.ok(new BrowserAuthenticationState(true, false))
);