Newer
Older
CNCTools / ReferenceSurfaceGenerator / frontend / src / App.test.js
@yangyang xie yangyang xie 23 days ago 643 bytes fix
import { render, screen } from '@testing-library/react';
import App from './App';

jest.mock('react-router-dom', () => ({
  ...jest.requireActual('react-router-dom'),
  BrowserRouter: ({ children }) => <div>{children}</div>,
  Routes: ({ children }) => <div>{children}</div>,
  Route: ({ element }) => element,
  Link: ({ children }) => <a>{children}</a>,
}));

test('renders the main components', () => {
  render(<App />);
  
  // Check for the Navbar brand
  expect(screen.getByText('CNC Toolbox')).toBeInTheDocument();
  
  // Check for the welcome message
  expect(screen.getByText('Welcome to the CNC Toolbox')).toBeInTheDocument();
});