6 Commits

Author SHA1 Message Date
Z. Cliffe Schreuders
26fc297ad8 Refactor tests and improve NPC handling
- Updated NPC ink loading tests to ensure proper handling of missing story files.
- Adjusted lazy loading tests for rooms to enhance clarity and maintainability.
- Enhanced unlock system tests by adding inventory checks for keys.
- Refined filtered scenario tests to ensure accurate preservation of game state.
- Improved game model tests to validate unlock functionality with various inventory scenarios.
2025-11-25 16:28:18 +00:00
Z. Cliffe Schreuders
6e65b9030d Add integration tests for asset loading and NPC story file handling
- Added tests to verify serving of door tile image and key-operations minigame module.
- Created new NPCInkLoadingTest to check various scenarios for NPC story file loading:
  - Return 404 for NPCs without story files and for non-existent NPCs.
  - Validate handling of missing NPC parameter.
  - Ensure correct API endpoint construction in npc-lazy-loader.
  - Verify person-chat and phone-chat minigames use the correct story loading endpoint.
  - Confirm npc-manager loads stories via API endpoint without direct fetch of storyPath.
  - Check asset path resolution in person-chat-portraits and phone-chat-ui.
  - Ensure ink endpoint returns correct MIME type and handles special characters in NPC IDs.
2025-11-21 15:27:54 +00:00
Z. Cliffe Schreuders
9ac86a2c8d Add integration and unit tests for asset loading and content type determination
- Created `AssetLoadingIntegrationTest` to verify the loading of game assets in the correct order, including JavaScript, CSS, and sound files.
- Implemented tests to ensure proper handling of asset paths, security constraints, and response headers.
- Added `StaticFilesControllerUnitTest` to test the content type determination logic for various file extensions, ensuring case insensitivity and handling of multiple dots in filenames.
2025-11-21 15:27:54 +00:00
Z. Cliffe Schreuders
4764f5881e test: Add comprehensive server response tests
- Add HTML response tests for missions index (checks mission cards rendered)
- Add game page tests (checks game container and config injection)
- Add API endpoint tests:
  * scenario endpoint returns JSON scenario data
  * bootstrap endpoint returns complete game state
  * sync_state endpoint updates player position
  * unlock endpoint validates and rejects invalid attempts
  * inventory endpoint adds items to player inventory
- Fix inventory API to use action_type instead of reserved 'action' param

All 23 tests passing with 64 assertions verifying server returns correct data!
2025-11-21 15:27:54 +00:00
Z. Cliffe Schreuders
8b71cf5f2f test: Add comprehensive test suite
- Add fixtures for missions, demo_users, games
- Add model tests for Mission and Game
- Add controller tests for MissionsController
- Test validations, scopes, and methods
- Test state management and health clamping
- Ready for integration testing in host app
2025-11-21 15:27:54 +00:00
Z. Cliffe Schreuders
680c7bfcae feat: Generate Rails Engine structure
- Create mountable engine with isolated namespace
- Configure Pundit authorization
- Set up gemspec with dependencies
- Configure generators for test_unit with fixtures
2025-11-21 15:27:53 +00:00