63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
/**
|
|
* Authentication & Registration Mock Data
|
|
*
|
|
* Typed mock objects for auth endpoints (registration, login).
|
|
* Extracted from api-data.ts for better organization.
|
|
*
|
|
* @module fixtures/api-data-auth
|
|
*/
|
|
|
|
export interface RegistrationRequestMockData {
|
|
email: string
|
|
username: string
|
|
password: string
|
|
role?: 'user' | 'provider' | 'client'
|
|
}
|
|
|
|
export interface RegistrationResponseMockData {
|
|
user: {
|
|
id: string
|
|
email: string
|
|
username: string
|
|
role: string
|
|
userTypes: string[]
|
|
isActive: boolean
|
|
emailVerified: boolean
|
|
createdAt: string
|
|
updatedAt: string
|
|
}
|
|
sessionId: string
|
|
}
|
|
|
|
export const MOCK_REGISTRATION_SUCCESS: RegistrationResponseMockData = {
|
|
user: {
|
|
id: 'user-e2e-001',
|
|
email: 'test@example.com',
|
|
username: 'testuser',
|
|
role: 'user',
|
|
userTypes: [],
|
|
isActive: true,
|
|
emailVerified: false,
|
|
createdAt: '2026-01-30T10:00:00.000Z',
|
|
updatedAt: '2026-01-30T10:00:00.000Z',
|
|
},
|
|
sessionId: 'session-e2e-001',
|
|
}
|
|
|
|
/**
|
|
* Create a registration response with custom email
|
|
*/
|
|
export function createRegistrationResponse(
|
|
email: string,
|
|
username?: string,
|
|
): RegistrationResponseMockData {
|
|
return {
|
|
user: {
|
|
...MOCK_REGISTRATION_SUCCESS.user,
|
|
id: `user-e2e-${Date.now()}`,
|
|
email,
|
|
username: username ?? email.split('@')[0] ?? 'testuser',
|
|
},
|
|
sessionId: `session-e2e-${Date.now()}`,
|
|
}
|
|
}
|