Skip to content

test : added unit tests for MiniGame component - #2

Open
tmdeveloper007 wants to merge 2 commits into
mainfrom
#8417
Open

tmdeveloper007 wants to merge 2 commits into
mainfrom
#8417

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Owner

Summary of What Has Been Done

Created components/MiniGame.test.tsx with comprehensive unit tests covering:

  • Idle state rendering (SQUASH THE BUGS overlay, Initialize button)
  • Game initialization on button click
  • Score display at game start (0)
  • Lives display (3 hearts)
  • Score increment on bug click
  • Game over (SYSTEM FAILURE) when all lives are lost
  • Reboot button resets the game to idle state

Mocked AudioContext and webkitAudioContext using vi.stubGlobal to prevent Web Audio API errors in the test environment.

Changes Made

  • New file: components/MiniGame.test.tsx

Impact it Made

Adds first unit test coverage for the MiniGame component, improving confidence in its core game loop logic and preventing regressions.

Closes #8417.

Note: please assign this PR to the tmdeveloper007 account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant