large mock refector hopefully done + no errors?
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h13m59s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h13m59s
This commit is contained in:
@@ -5,7 +5,7 @@ import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
||||
import { AuthView } from './AuthView';
|
||||
import * as apiClient from '../../../services/apiClient';
|
||||
import { notifySuccess, notifyError } from '../../../services/notificationService';
|
||||
import { createMockUser } from '../../../tests/utils/mockFactories';
|
||||
import { createMockUserProfile } from '../../../tests/utils/mockFactories';
|
||||
|
||||
const mockedApiClient = vi.mocked(apiClient, true);
|
||||
|
||||
@@ -19,7 +19,7 @@ const defaultProps = {
|
||||
|
||||
const setupSuccessMocks = () => {
|
||||
const mockAuthResponse = {
|
||||
user: createMockUser({ user_id: '123', email: 'test@example.com' }),
|
||||
user: createMockUserProfile({ user_id: '123', user: { user_id: '123', email: 'test@example.com' } }),
|
||||
token: 'mock-token',
|
||||
};
|
||||
(mockedApiClient.loginUser as Mock).mockResolvedValue(new Response(JSON.stringify(mockAuthResponse)));
|
||||
@@ -66,7 +66,7 @@ describe('AuthView', () => {
|
||||
await waitFor(() => {
|
||||
expect(mockedApiClient.loginUser).toHaveBeenCalledWith('test@example.com', 'password123', true, expect.any(AbortSignal));
|
||||
expect(mockOnLoginSuccess).toHaveBeenCalledWith(
|
||||
{ user_id: '123', email: 'test@example.com' },
|
||||
expect.objectContaining({ user_id: '123', user: expect.objectContaining({ email: 'test@example.com' }) }),
|
||||
'mock-token',
|
||||
true
|
||||
);
|
||||
@@ -120,7 +120,7 @@ describe('AuthView', () => {
|
||||
await waitFor(() => {
|
||||
expect(mockedApiClient.registerUser).toHaveBeenCalledWith('new@example.com', 'newpassword', 'Test User', '', expect.any(AbortSignal));
|
||||
expect(mockOnLoginSuccess).toHaveBeenCalledWith(
|
||||
{ user_id: '123', email: 'test@example.com' },
|
||||
expect.objectContaining({ user_id: '123' }),
|
||||
'mock-token',
|
||||
false // rememberMe is false for registration
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user