Skip to content

Commit 4da3fe9

Browse files
test: Fix lint and type errors in QuestionEngine.test.tsx
- Removed unused `waitFor` import - Used type-only imports for `Mock` and `QuestionDocument` - Replaced `any` with specific types in mocks
1 parent 5b384da commit 4da3fe9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/game/__tests__/QuestionEngine.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
2-
import { vi, describe, it, expect, beforeEach, Mock } from 'vitest';
1+
import { render, screen, fireEvent } from '@testing-library/react';
2+
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
33
import QuestionEngine from '../QuestionEngine';
44
import { useAuth } from '../../../hooks/useAuth';
55
import { usePyodide } from '../../../context/PyodideContext';
66
import { useMascotContext } from '../../../context/MascotContext';
77
import { playSound } from '../../../utils/soundEffects';
88
import confetti from 'canvas-confetti';
9-
import { QuestionDocument } from '../../../types/question';
9+
import type { QuestionDocument } from '../../../types/question';
1010

1111
// Mocks
1212
vi.mock('../../../hooks/useAuth');
@@ -19,7 +19,7 @@ vi.mock('canvas-confetti', () => ({
1919

2020
// Mock Child Components
2121
vi.mock('../questionTypes', () => ({
22-
MultipleChoiceQuestion: ({ onAnswer }: any) => (
22+
MultipleChoiceQuestion: ({ onAnswer }: { onAnswer: (correct: boolean) => void }) => (
2323
<div data-testid="multiple-choice">
2424
<button onClick={() => onAnswer(true)}>Correct</button>
2525
<button onClick={() => onAnswer(false)}>Incorrect</button>
@@ -34,7 +34,7 @@ vi.mock('../questionTypes', () => ({
3434
}));
3535

3636
vi.mock('../questionTypes/BossBattleQuestion', () => ({
37-
BossBattleQuestion: ({ onRun, onComplete }: any) => (
37+
BossBattleQuestion: ({ onRun, onComplete }: { onRun: (code: string) => void; onComplete: (score: number) => void }) => (
3838
<div data-testid="boss-battle">
3939
<button onClick={() => onRun('print("hello")')}>Run Code</button>
4040
<button onClick={() => onComplete(100)}>Complete Boss</button>
@@ -43,7 +43,7 @@ vi.mock('../questionTypes/BossBattleQuestion', () => ({
4343
}));
4444

4545
vi.mock('../feedback/ResultPanel', () => ({
46-
ResultPanel: ({ success, points, onNext, onRetry }: any) => (
46+
ResultPanel: ({ success, points, onNext, onRetry }: { success: boolean; points?: number; onNext?: () => void; onRetry?: () => void }) => (
4747
<div data-testid="result-panel">
4848
{success ? 'Success' : 'Failure'}
4949
{points !== undefined && ` Points: ${points}`}
@@ -54,7 +54,7 @@ vi.mock('../feedback/ResultPanel', () => ({
5454
}));
5555

5656
vi.mock('../../education', () => ({
57-
ProgressiveHints: ({ onHintRevealed }: any) => (
57+
ProgressiveHints: ({ onHintRevealed }: { onHintRevealed: (hintId: string, cost: number) => void }) => (
5858
<div data-testid="progressive-hints">
5959
<button onClick={() => onHintRevealed('hint_1', 10)}>Reveal Hint</button>
6060
</div>

0 commit comments

Comments
 (0)