import { describe, it, expect, beforeEach, vi } from 'vitest' import { EventCard, EventModal, EventsSection } from '../../src/components/Events.js' describe('Events', () => { beforeEach(() => { vi.clearAllMocks() }) describe('EventCard', () => { it('should render event card with basic information', () => { const event = { id: 1, host_id: 2, title: 'Test Event', date: '2024-12-25', host: { name: 'John Doe' }, description: 'A test event', rsvps: [], image_url: 'https://example.com/image.jpg' } const result = EventCard(event) expect(result).toContain('Test Event') expect(result).toContain('John Doe') expect(result).toContain('A test event') expect(result).toContain('https://example.com/image.jpg') expect(result).toContain('0 went') }) it('should handle missing optional fields', () => { const event = { id: 1, title: 'Test Event', date: '2024-12-25T10:00:00Z', host_id: 123, rsvps: [], image_url: 'http://image.web' } const result = EventCard(event) expect(result).toContain('Test Event') expect(result).toContain('User 123') expect(result).not.toContain('undefined') }) it('should show past events correctly', () => { const event = { id: 1, host_id: 4, title: 'Past Event', date: '1995-01-01', host: { name: 'John Doe' }, image_url: 'http://image.web', rsvps: [{}, {}] // 2 RSVPs } const result = EventCard(event); expect(result).toContain('2 went'); expect(result).not.toContain('