App.test.tsx 880 Bytes
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { describe, expect, it } from 'vitest';

import { App } from './App';

describe('App foundation', () => {
  it('renders the root layout for the React application', () => {
    render(
      <MemoryRouter initialEntries={['/']}>
        <App />
      </MemoryRouter>,
    );

    expect(screen.getByRole('main')).toBeInTheDocument();
    expect(screen.getByText('Agent Admin Web')).toBeInTheDocument();
  });

  it('renders the independent component demo route', () => {
    render(
      <MemoryRouter initialEntries={['/components']}>
        <App />
      </MemoryRouter>,
    );

    expect(screen.getByRole('heading', { name: '组件库 Demo' })).toBeInTheDocument();
    expect(screen.getByText('全局 UI 组件库展示入口')).toBeInTheDocument();
  });
});