import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';

vi.mock('./components/ListingsTab.jsx', () => ({ default: () => <div>LISTINGS_TAB</div> }));
vi.mock('./components/ToolsTab.jsx', () => ({ default: () => <div>TOOLS_TAB</div> }));
vi.mock('./components/CriteriaTab.jsx', () => ({ default: () => <div>CRITERIA_TAB</div> }));
vi.mock('react-router-dom', () => ({ Link: ({ children }) => <a>{children}</a> }));
import Listings from './Listings.jsx';

describe('Listings', () => {
  it('기본 매물 탭 렌더 + 탭 전환', () => {
    render(<Listings />);
    expect(screen.getByText('LISTINGS_TAB')).toBeInTheDocument();
    fireEvent.click(screen.getByRole('button', { name: '판정 도구' }));
    expect(screen.getByText('TOOLS_TAB')).toBeInTheDocument();
    fireEvent.click(screen.getByRole('button', { name: '조건' }));
    expect(screen.getByText('CRITERIA_TAB')).toBeInTheDocument();
  });
});
