wip
This commit is contained in:
@@ -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))
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user