import { describe, it, expect, vi } from 'vitest'
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import App from './App.jsx'
// Mock only the components, not the hook
vi.mock('./components/ChatWindow.jsx', () => ({
ChatWindow: () =>
ChatWindow Mock
}))
vi.mock('./components/SessionDrawer.jsx', () => ({
SessionDrawer: ({ isOpen }) => isOpen ? SessionDrawer Mock
: null
}))
describe('App', () => {
it('should render app with menu button', async () => {
render()
// Wait for loading to finish (hook will set isLoading false after mount)
await waitFor(() => {
expect(screen.getByTestId('chat-window')).toBeInTheDocument()
})
// Check menu button exists
expect(screen.getByTitle(/Open Menu/i)).toBeInTheDocument()
})
it('should open session drawer when menu clicked', async () => {
render()
await waitFor(() => {
expect(screen.getByTestId('chat-window')).toBeInTheDocument()
})
fireEvent.click(screen.getByTitle(/Open Menu/i))
await waitFor(() => {
expect(screen.getByTestId('session-drawer')).toBeInTheDocument()
})
})
})