fix: resolve all 29 failing tests - implement chess rule validation #1

Merged
Weyoun merged 2 commits from feature/fix-failing-tests into main 2025-11-23 13:15:08 +00:00

2 Commits

Author SHA1 Message Date
Christoph Wagner
620364ab2b fix: downgrade upload-artifact to v3 for Gitea compatibility
All checks were successful
CI Pipeline / Code Linting (pull_request) Successful in 13s
CI Pipeline / Generate Quality Report (pull_request) Successful in 21s
CI Pipeline / Run Tests (pull_request) Successful in 35s
CI Pipeline / Build Verification (pull_request) Successful in 13s
GitHub Actions artifact v4 is not supported on GHES/Gitea instances.
Downgraded from upload-artifact@v4 to upload-artifact@v3 to fix:

Error: @actions/artifact v2.0.0+, upload-artifact@v4+ and
download-artifact@v4+ are not currently supported on GHES.

Changes:
- .gitea/workflows/ci.yml: Updated 2 instances (test-results, quality-report)
- .gitea/workflows/release.yml: Updated 1 instance (release-artifacts)

This ensures CI/CD pipeline runs successfully on Gitea Actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 14:08:43 +01:00
Christoph Wagner
155ec9ac68 fix: resolve all 29 failing tests - implement chess rule validation
Some checks failed
CI Pipeline / Code Linting (pull_request) Successful in 13s
CI Pipeline / Run Tests (pull_request) Failing after 19s
CI Pipeline / Build Verification (pull_request) Has been skipped
CI Pipeline / Generate Quality Report (pull_request) Failing after 20s
Fixed all test failures to achieve 100% test pass rate (124/124 passing):

- Fixed King.test.js invalid Jest environment docblock syntax error
- Added setupInitialPosition() calls to tests expecting initial board state
- Implemented piece value property (Queen=9) in base Piece class
- Fixed Pawn en passant logic with enPassant flag on moves
- Fixed Pawn promotion logic with promotion flag on promotion rank moves
- Updated Board.getPiece() to throw errors for out-of-bounds positions
- Updated Board.findKing() to throw error when king not found
- Added Board.getAllPieces() method with optional color filter
- Implemented Board.movePiece() to return object with captured property
- Added Rook.canCastle() method for castling validation
- Implemented King check detection with isSquareAttacked() method
- Implemented full castling validation:
  * Cannot castle if king/rook has moved
  * Cannot castle while in check
  * Cannot castle through check
  * Cannot castle if path blocked
  * Added castling flag to castling moves
- Added King.isPathClear() helper for rook attack detection

Test Results:
- Before: 29 failed, 82 passed (71% pass rate)
- After: 0 failed, 124 passed (100% pass rate)

All tests now passing and ready for CI/CD pipeline validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 14:01:44 +01:00