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' ;
33import QuestionEngine from '../QuestionEngine' ;
44import { useAuth } from '../../../hooks/useAuth' ;
55import { usePyodide } from '../../../context/PyodideContext' ;
66import { useMascotContext } from '../../../context/MascotContext' ;
77import { playSound } from '../../../utils/soundEffects' ;
88import confetti from 'canvas-confetti' ;
9- import { QuestionDocument } from '../../../types/question' ;
9+ import type { QuestionDocument } from '../../../types/question' ;
1010
1111// Mocks
1212vi . mock ( '../../../hooks/useAuth' ) ;
@@ -19,7 +19,7 @@ vi.mock('canvas-confetti', () => ({
1919
2020// Mock Child Components
2121vi . 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
3636vi . 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
4545vi . 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
5656vi . 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