import React from 'react';
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import { AuthProviderButtons } from './AuthProviderButtons';
describe('AuthProviderButtons', () => {
describe('rendering', () => {
it('should render with single button', () => {
render(
);
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
});
it('should render with multiple buttons', () => {
render(
);
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
expect(screen.getByText('Sign in with Discord')).toBeInTheDocument();
expect(screen.getByText('Sign in with GitHub')).toBeInTheDocument();
});
it('should render with anchor links', () => {
render(
Sign in with GoogleSign in with Discord
);
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
expect(screen.getByText('Sign in with Discord')).toBeInTheDocument();
});
it('should render with mixed element types', () => {
render(
Sign in with Discord
);
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
expect(screen.getByText('Sign in with Discord')).toBeInTheDocument();
expect(screen.getByText('Sign in with GitHub')).toBeInTheDocument();
});
});
describe('accessibility', () => {
it('should have proper button semantics', () => {
render(
);
const button = screen.getByRole('button', { name: 'Sign in with Google' });
expect(button).toBeInTheDocument();
});
it('should have proper link semantics', () => {
render(
Sign in with Google
);
const link = screen.getByRole('link', { name: 'Sign in with Google' });
expect(link).toBeInTheDocument();
});
it('should maintain focus order', () => {
render(
);
const buttons = screen.getAllByRole('button');
expect(buttons).toHaveLength(3);
});
});
describe('edge cases', () => {
it('should handle empty children', () => {
render({null});
// Component should render without errors
});
it('should handle undefined children', () => {
render({undefined});
// Component should render without errors
});
it('should handle empty string children', () => {
render({''});
// Component should render without errors
});
it('should handle nested children', () => {
render(
);
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
});
it('should handle complex button structures', () => {
render(
);
expect(screen.getByText('Sign in with')).toBeInTheDocument();
expect(screen.getByText('Google')).toBeInTheDocument();
});
it('should handle buttons with icons', () => {
render(
);
expect(screen.getByTestId('icon')).toBeInTheDocument();
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
});
});
describe('visual states', () => {
it('should maintain grid layout', () => {
render(
);
// The component uses Grid for layout
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
expect(screen.getByText('Sign in with Discord')).toBeInTheDocument();
});
it('should maintain spacing', () => {
render(
);
// The component uses Box with marginBottom and Grid with gap
expect(screen.getByText('Sign in with Google')).toBeInTheDocument();
expect(screen.getByText('Sign in with Discord')).toBeInTheDocument();
expect(screen.getByText('Sign in with GitHub')).toBeInTheDocument();
});
});
});