Testing
Current state
Testing is minimal. The project uses Jest via Create React App:
npm test
Runs react-scripts test in watch mode.
Existing tests
| File | Coverage |
|---|---|
src/pages/Skeleton.test.js |
Smoke render of Skeleton |
Dependencies: @testing-library/jest-dom, @testing-library/user-event.
Jest config
CRA overrides live in config/jest/babelTransform.js and fileTransform.js. There is no setupTests.js in the repo today.
Adding tests
- Colocate tests as
Component.test.jsnext to the component, or undersrc/pages/for page shells. - Import from
@testing-library/reactand@testing-library/user-event. - Mock heavy dependencies:
aws-amplify/Authfor auth flowsfetchfor API calls@abstractplay/gameslib/@abstractplay/rendererfor game components
Example pattern:
import { render, screen } from "@testing-library/react";
import MyComponent from "./MyComponent";
test("renders heading", () => {
render(<MyComponent />);
expect(screen.getByText(/expected/i)).toBeInTheDocument();
});
What to prioritize
High-value test targets if expanding coverage:
callAuthApi— token missing, 401 redirectbotApi.js— response envelope parsing- Pure functions in
src/lib/GameMove/— exploration, settings - Route smoke tests for critical pages
Linting
ESLint config: .eslintrc.json (eslint:recommended, react-app, react-hooks).