Fix hanging test and update README with resign feature
- Fix page.test.tsx: Use stable mock router reference to prevent infinite loop The useRouter mock was returning a new object on every render, causing the useEffect with router dependency to re-run infinitely - Update README to document resign button and analyze game features
This commit is contained in:
@@ -23,7 +23,8 @@ This application was built using **Antigravity by Google**. I like to work with
|
|||||||
- Strategic and positional considerations
|
- Strategic and positional considerations
|
||||||
6. **Chat with Your Tutor**: Ask questions anytime using the integrated chat feature - your tutor will answer in character
|
6. **Chat with Your Tutor**: Ask questions anytime using the integrated chat feature - your tutor will answer in character
|
||||||
7. **Export Your Game**: Download your game as PGN or export the current position as FEN at any time
|
7. **Export Your Game**: Download your game as PGN or export the current position as FEN at any time
|
||||||
8. **Post-Game Analysis**: When the game ends, review a comprehensive analysis showing:
|
8. **Resign When Needed**: Use the resign button to end the game early - your AI tutor will provide a final in-character message acknowledging the resignation
|
||||||
|
9. **Post-Game Analysis**: When the game ends (including by resignation), review a comprehensive analysis showing:
|
||||||
- All your mistakes and inaccuracies
|
- All your mistakes and inaccuracies
|
||||||
- Missed tactical opportunities throughout the game
|
- Missed tactical opportunities throughout the game
|
||||||
- Learning opportunities and improvement suggestions
|
- Learning opportunities and improvement suggestions
|
||||||
@@ -41,6 +42,8 @@ This application was built using **Antigravity by Google**. I like to work with
|
|||||||
- **Move Analysis**: Detailed feedback on every move you make with tactical insights
|
- **Move Analysis**: Detailed feedback on every move you make with tactical insights
|
||||||
- **Interactive Chat**: Ask your AI tutor questions and get personalized answers
|
- **Interactive Chat**: Ask your AI tutor questions and get personalized answers
|
||||||
- **Post-Game Analysis**: Review all your mistakes and missed opportunities after each game
|
- **Post-Game Analysis**: Review all your mistakes and missed opportunities after each game
|
||||||
|
- **Resign Option**: End games early with a resign button - your AI tutor responds in character
|
||||||
|
- **Direct Analysis Access**: Jump straight to the analysis page from the game over modal
|
||||||
- **Multi-Language Support**: Available in English, German, French, Italian, and Polish
|
- **Multi-Language Support**: Available in English, German, French, Italian, and Polish
|
||||||
- **FEN/PGN Import**: Import positions or games with automatic format detection
|
- **FEN/PGN Import**: Import positions or games with automatic format detection
|
||||||
- **Game Export**: Download your games as PGN or export current position as FEN
|
- **Game Export**: Download your games as PGN or export current position as FEN
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
import { render, screen, fireEvent } from '@testing-library/react';
|
import { render, screen, fireEvent } from '@testing-library/react';
|
||||||
import Home from '../page';
|
import Home from '../page';
|
||||||
|
|
||||||
|
const mockPush = jest.fn();
|
||||||
|
const mockRouter = {
|
||||||
|
push: mockPush,
|
||||||
|
};
|
||||||
|
|
||||||
jest.mock('next/navigation', () => ({
|
jest.mock('next/navigation', () => ({
|
||||||
useRouter: () => ({
|
useRouter: () => mockRouter,
|
||||||
push: jest.fn(),
|
|
||||||
}),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock('@/components/ChessGame', () => ({
|
jest.mock('@/components/ChessGame', () => ({
|
||||||
@@ -27,6 +30,7 @@ jest.mock('@/components/StartScreen', () => ({
|
|||||||
describe('Home Component', () => {
|
describe('Home Component', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
localStorage.setItem('gemini_api_key', 'test-key');
|
localStorage.setItem('gemini_api_key', 'test-key');
|
||||||
|
mockPush.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders the start screen initially', () => {
|
it('renders the start screen initially', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user