unit tests fixin
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 55s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 55s
This commit is contained in:
@@ -81,10 +81,10 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
it('should render the Sign In form when authStatus is SIGNED_OUT', () => {
|
||||
render(<ProfileManager {...defaultProps} />);
|
||||
|
||||
expect(screen.getByRole('heading', { name: /sign in/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('heading', { name: /^sign in$/i })).toBeInTheDocument();
|
||||
expect(screen.getByLabelText(/email address/i)).toBeInTheDocument();
|
||||
expect(screen.getByLabelText(/^Password$/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /sign in/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^sign in$/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /register/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /forgot password/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /sign in with google/i })).toBeInTheDocument();
|
||||
@@ -109,7 +109,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
|
||||
fireEvent.change(screen.getByLabelText(/^Email Address$/i), { target: { value: 'user@test.com' } });
|
||||
fireEvent.change(screen.getByLabelText(/^Password$/i), { target: { value: 'securepassword' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: /sign in/i }));
|
||||
fireEvent.click(screen.getByRole('button', { name: /^sign in$/i }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(apiClient.loginUser).toHaveBeenCalledWith('user@test.com', 'securepassword');
|
||||
@@ -127,7 +127,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
|
||||
fireEvent.change(screen.getByLabelText(/^Email Address$/i), { target: { value: 'user@test.com' } });
|
||||
fireEvent.change(screen.getByLabelText(/^Password$/i), { target: { value: 'wrongpassword' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: /sign in/i }));
|
||||
fireEvent.click(screen.getByRole('button', { name: /^sign in$/i }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Invalid credentials')).toBeInTheDocument();
|
||||
@@ -140,7 +140,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
(apiClient.loginUser as Mock).mockReturnValueOnce(new Promise(() => {})); // Never resolve
|
||||
render(<ProfileManager {...defaultProps} />);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /sign in/i }));
|
||||
fireEvent.click(screen.getByRole('button', { name: /^sign in$/i }));
|
||||
|
||||
expect(screen.getByTestId('loading-spinner')).toBeInTheDocument();
|
||||
});
|
||||
@@ -259,7 +259,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /back to sign in/i }));
|
||||
|
||||
expect(screen.getByRole('heading', { name: /sign in/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('heading', { name: /^sign in$/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// --- OAuth Buttons ---
|
||||
@@ -305,7 +305,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
expect(screen.getByRole('tab', { name: /security/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('tab', { name: /data & privacy/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('tab', { name: /preferences/i })).toBeInTheDocument();
|
||||
expect(screen.queryByRole('heading', { name: /sign in/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('heading', { name: /^sign in$/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
// --- Modal Close ---
|
||||
@@ -325,7 +325,7 @@ describe('ProfileManager Authentication Flows', () => {
|
||||
it('should not call onClose when clicking inside the modal content', () => {
|
||||
render(<ProfileManager {...defaultProps} />);
|
||||
// Simulate clicking on the modal content itself
|
||||
fireEvent.click(screen.getByRole('heading', { name: /sign in/i }));
|
||||
fireEvent.click(screen.getByRole('heading', { name: /^sign in$/i }));
|
||||
expect(mockOnClose).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user