import { describe, it, expect, vi, afterEach } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { SignUpForm } from '../../components/auth/sign-up-form';
import { SignInForm } from '../../components/auth/sign-in-form';

afterEach(() => {
    cleanup();
});

// Mock the auth client since it's used in components
vi.mock('@/lib/auth-client', () => ({
    signIn: {
        email: vi.fn(),
    },
    signUp: {
        email: vi.fn(),
    },
}));

// Mock next/navigation
vi.mock("next/navigation", () => ({
    useRouter: () => ({
        push: vi.fn(),
        replace: vi.fn(),
        prefetch: vi.fn(),
    }),
    useSearchParams: () => new URLSearchParams(),
    usePathname: () => "/",
}));

describe('Auth Components', () => {
    it('should render SignUpForm', () => {
        render(<SignUpForm />);
        expect(screen.getByRole('button', { name: /continue with google/i })).toBeDefined();
    });

    it('should render SignInForm', () => {
        render(<SignInForm />);
        expect(screen.getByRole('button', { name: /continue with google/i })).toBeDefined();
    });
});
