Spaces:
Runtime error
Runtime error
File size: 1,130 Bytes
980bfc2 ceb943f 980bfc2 ceb943f 980bfc2 ceb943f 980bfc2 ceb943f 980bfc2 ceb943f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 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();
});
});
|