projects icon indicating copy to clipboard operation
projects copied to clipboard

Fix issue 323 prototypes tests

Open Felsilva15 opened this issue 2 months ago • 2 comments
trafficstars

PR Checklist

Overview

Add comprehensive test suite for the prototypes-to-classes exercise in the-typeinator project.

This PR adds the missing index.test.js file that was requested in issue #323. The test file includes:

  • Conditional test skipping: Tests are skipped when index.js is empty (learner mode), allowing students to start with clean files
  • Solution validation: Tests run properly when TEST_SOLUTIONS=true is set (validation mode)
  • Comprehensive coverage: Tests for both Robot and Humanoid classes including:
    • Class construction with proper properties
    • Method functionality (announce, charge, move)
    • Inheritance behavior (Humanoid extends Robot)
    • Console output validation with Jest mocks
    • Power management and error handling logic

The implementation follows the same pattern established in other test files in the repository, ensuring consistency with the educational workflow.

Felsilva15 avatar Sep 09 '25 03:09 Felsilva15