clean routes
This commit is contained in:
@@ -12,7 +12,6 @@ describe('AuthService', () => {
|
||||
signup: vi.fn(),
|
||||
login: vi.fn(),
|
||||
logout: vi.fn(),
|
||||
getIracingAuthUrl: vi.fn(),
|
||||
} as Mocked<AuthApiClient>;
|
||||
|
||||
service = new AuthService(mockApiClient);
|
||||
@@ -118,29 +117,4 @@ describe('AuthService', () => {
|
||||
await expect(service.logout()).rejects.toThrow('Logout failed');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getIracingAuthUrl', () => {
|
||||
it('should call apiClient.getIracingAuthUrl with returnTo', () => {
|
||||
const returnTo = '/dashboard';
|
||||
const expectedUrl = 'https://api.example.com/auth/iracing/start?returnTo=%2Fdashboard';
|
||||
|
||||
mockApiClient.getIracingAuthUrl.mockReturnValue(expectedUrl);
|
||||
|
||||
const result = service.getIracingAuthUrl(returnTo);
|
||||
|
||||
expect(mockApiClient.getIracingAuthUrl).toHaveBeenCalledWith(returnTo);
|
||||
expect(result).toBe(expectedUrl);
|
||||
});
|
||||
|
||||
it('should call apiClient.getIracingAuthUrl without returnTo', () => {
|
||||
const expectedUrl = 'https://api.example.com/auth/iracing/start';
|
||||
|
||||
mockApiClient.getIracingAuthUrl.mockReturnValue(expectedUrl);
|
||||
|
||||
const result = service.getIracingAuthUrl();
|
||||
|
||||
expect(mockApiClient.getIracingAuthUrl).toHaveBeenCalledWith(undefined);
|
||||
expect(result).toBe(expectedUrl);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -2,7 +2,6 @@ import { AuthApiClient } from '../../api/auth/AuthApiClient';
|
||||
import { SessionViewModel } from '../../view-models/SessionViewModel';
|
||||
import type { LoginParamsDTO } from '../../types/generated/LoginParamsDTO';
|
||||
import type { SignupParamsDTO } from '../../types/generated/SignupParamsDTO';
|
||||
import type { LoginWithIracingCallbackParamsDTO } from '../../types/generated/LoginWithIracingCallbackParamsDTO';
|
||||
import type { ForgotPasswordDTO } from '../../types/generated/ForgotPasswordDTO';
|
||||
import type { ResetPasswordDTO } from '../../types/generated/ResetPasswordDTO';
|
||||
import type { DemoLoginDTO } from '../../types/generated/DemoLoginDTO';
|
||||
@@ -53,25 +52,6 @@ export class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get iRacing authentication URL
|
||||
*/
|
||||
getIracingAuthUrl(returnTo?: string): string {
|
||||
return this.apiClient.getIracingAuthUrl(returnTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Login with iRacing callback
|
||||
*/
|
||||
async loginWithIracingCallback(params: LoginWithIracingCallbackParamsDTO): Promise<SessionViewModel> {
|
||||
try {
|
||||
const dto = await this.apiClient.loginWithIracingCallback(params);
|
||||
return new SessionViewModel(dto.user);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgot password - send reset link
|
||||
*/
|
||||
@@ -105,4 +85,4 @@ export class AuthService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user