Skip to content

Add unit tests to fix CI "No tests found" failure#9

Draft
Copilot wants to merge 4 commits intocopilot/review-ci-run-detailsfrom
copilot/refactor-image-upload-process
Draft

Add unit tests to fix CI "No tests found" failure#9
Copilot wants to merge 4 commits intocopilot/review-ci-run-detailsfrom
copilot/refactor-image-upload-process

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 28, 2026

📝 Description

CI was failing with No tests found, exiting with code 1 — Jest found zero matching test files. Adds 42 unit tests across 4 suites covering the core game logic modules.

🎮 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • ⚡ Performance improvement
  • 🎨 Style/UI update
  • ♻️ Code refactoring
  • 🧪 Test update

🎯 Game Mode Impact

  • RTS (Commander View)
  • FPS (Field Operative View)
  • Both modes
  • UI/Menu only
  • Backend/Infrastructure

🔍 What Changed?

Added

  • src/__tests__/constants.test.ts — validates all exported constants (colors, camera FOV/distances, performance budgets, material properties, physics values, resource names)
  • src/__tests__/gameStore.test.ts — covers all useGameStore actions: selectUnit, enterFPS, exitFPS, togglePause, reset; asserts initial state and state transitions
  • src/__tests__/resourceStore.test.ts — covers addCredits/Fuel/Power, consumeCredits/Fuel (sufficient and insufficient cases), setPowerConsumption/Production, reset
  • src/__tests__/pathfinding.test.ts — covers AStarPathfinder: direct paths, diagonal routing, obstacle avoidance, unreachable goals, same-node paths, y=0 constraint on all nodes

Changed

Fixed

  • CI pipeline no longer exits with code 1 due to missing test files

Removed

📸 Screenshots/Videos

N/A

🧪 Testing

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing on iOS Simulator
  • Manual testing on physical iOS device
  • Performance testing

Test Configuration

  • Device: N/A
  • iOS Version: N/A
  • Test Scenario: npm test -- --coverage --maxWorkers=2 — 4 suites, 42 tests, all pass

✅ Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

🎯 Performance Impact

  • FPS Impact: None
  • Memory Impact: None
  • Build Size Impact: None

📋 Related Issues

Relates to https://github.com/astickleyid/iron-command-ios/actions/runs/21166989269/job/61015583962

📝 Additional Notes

Tests run against existing source without mocks — useGameStore and useResourceStore are exercised via getState() directly (no React renderer needed); AStarPathfinder is instantiated with a small 20×20 grid to keep tests fast.

🎖️ Deployment Notes

No deployment impact.


By submitting this PR, I confirm that:

  • I have read and followed the CONTRIBUTING.md guidelines
  • I have tested my changes thoroughly
  • I am ready for this PR to be reviewed
Original prompt

Reference: https://github.com/astickleyid/iron-command-ios/actions/runs/21166989269/job/61015583962#step:5:1


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: astickleyid <201894828+astickleyid@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor image upload process for improved reliability Add unit tests to fix CI "No tests found" failure Feb 28, 2026
@astickleyid astickleyid requested a review from Copilot March 2, 2026 07:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Jest unit tests under src/__tests__ to ensure CI no longer fails with “No tests found” and to provide baseline coverage for core game logic modules (constants, Zustand stores, and A* pathfinding).

Changes:

  • Added unit tests validating exported config constants (palette, camera, performance, materials, physics, resources).
  • Added unit tests for useGameStore and useResourceStore state transitions and reset behavior.
  • Added unit tests for AStarPathfinder path generation, obstacle avoidance, and edge cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/tests/constants.test.ts Verifies key exported values from src/config/constants.ts to prevent accidental config drift.
src/tests/gameStore.test.ts Exercises useGameStore initial state and action-driven transitions (RTS/FPS, pause, reset).
src/tests/resourceStore.test.ts Exercises useResourceStore initial state, add/consume operations, power accounting setters, and reset.
src/tests/pathfinding.test.ts Validates AStarPathfinder pathfinding behavior across clear routes, obstacles, unreachable goals, and invariants (y=0).

astickleyid and others added 2 commits March 21, 2026 13:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants