refactor: code review improvements
- Add 30s timeout to Stockfish evaluation to prevent hanging promises - Add FEN validation and depth cap (max 30) to Stockfish API route - Create ErrorBoundary component with specialized fallbacks for chess game and tutor - Extract useChessSounds hook for better audio management - Add React.memo to EvaluationBar and CapturedPieces for performance - Add useMemo to CapturedPieces for sorted pieces calculation - Improve tacticDetection to return empty array instead of "none" type - Add filterMeaningfulTactics and hasTactics helper functions - Translate hardcoded UI strings (stockfishLevel, download, evalChange) - Update translations for EN, DE, FR, IT, PL - Add uuid to Jest transformIgnorePatterns for ESM compatibility - Update tests to use new filterMeaningfulTactics function
This commit is contained in:
@@ -170,7 +170,7 @@ describe('tacticDetection', () => {
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
|
||||
it('should return "none" tactic if no specific tactics found', () => {
|
||||
it('should return empty array if no specific tactics found', () => {
|
||||
const fen = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1';
|
||||
const result = detectMissedTactics({
|
||||
fen,
|
||||
@@ -180,8 +180,8 @@ describe('tacticDetection', () => {
|
||||
cpLoss: 60,
|
||||
});
|
||||
|
||||
expect(result.length).toBe(1);
|
||||
expect(result[0].tactic_type).toBe('none');
|
||||
// Returns empty array when no specific tactics detected
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
|
||||
it('should handle custom evalLossThreshold', () => {
|
||||
|
||||
Reference in New Issue
Block a user