CatStation/Content.IntegrationTests/Tests
Pieter-Jan Briers 0c97520276
Fix usages of TryIndex() (#39124)
* Fix usages of TryIndex()

Most usages of TryIndex() were using it incorrectly. Checking whether prototype IDs specified in prototypes actually existed before using them. This is not appropriate as it's just hiding bugs that should be getting caught by the YAML linter and other tools. (#39115)

This then resulted in TryIndex() getting modified to log errors (94f98073b0), which is incorrect as it causes false-positive errors in proper uses of the API: external data validation. (#39098)

This commit goes through and checks every call site of TryIndex() to see whether they were correct. Most call sites were replaced with the new Resolve(), which is suitable for these "defensive programming" use cases.

Fixes #39115

Breaking change: while doing this I noticed IdCardComponent and related systems were erroneously using ProtoId<AccessLevelPrototype> for job prototypes. This has been corrected.

* fix tests

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-09-09 18:17:56 +02:00
..
Access Access Reader Refactor (#37772) 2025-06-05 19:28:55 -04:00
Actions HandsSystem Refactor (#38438) 2025-06-25 15:13:03 +02:00
Administration/Logs Un-revert #26994 2024-04-20 17:01:15 -04:00
Atmos Improve Gas Yaml Serialization (#40070) 2025-09-04 20:48:46 +02:00
Body Moar engine changes 2024-12-24 18:57:52 +13:00
Buckle HandsSystem Refactor (#38438) 2025-06-25 15:13:03 +02:00
Chameleon Cleanup ChameleonJobLoadoutTest (#38229) 2025-06-10 15:51:23 -07:00
Chemistry HandsSystem Refactor (#38438) 2025-06-25 15:13:03 +02:00
Cleanup Un-revert IPlayerManager refactor (#21244) 2023-10-28 09:59:53 +11:00
Climbing Partial buckling refactor (#29031) 2024-06-20 01:14:18 +10:00
Cloning Validate CloningSettingsPrototypes (#38688) 2025-07-01 20:31:39 -04:00
Commands Fix usages of TryIndex() (#39124) 2025-09-09 18:17:56 +02:00
Construction Don't enqueue construction events without validation (#39869) 2025-09-03 14:29:50 -07:00
Damageable Add test of StaminaComponent crit vs animation thresholds (#39249) 2025-08-02 16:33:22 +02:00
Destructible Validate ProtoIds in tests (#38745) 2025-07-04 22:48:55 +02:00
DeviceLinking Fix wrong assert message in DeviceLinkingTest (#35964) 2025-03-20 20:58:09 +01:00
DeviceNetwork Predict dumping (#32394) 2025-04-19 16:20:40 +10:00
Disposal Add test of disposal unit throw-insert behavior (#39479) 2025-08-27 22:30:53 +02:00
DoAfter Add StorageInteractionTest (#28541) 2024-06-03 17:05:51 -04:00
Doors EVENT BASED WEIGHTLESSNESS (#37971) 2025-08-19 14:35:09 -04:00
Embedding Fix embedded projectile deletion not being tracked by container (#36123) 2025-03-28 11:43:13 +03:00
EncryptionKeys Add StorageInteractionTest (#28541) 2024-06-03 17:05:51 -04:00
Engineering Inflatable Module (#35100) 2025-08-23 15:15:28 -07:00
Explosion Add validation test for ExplosionPrototypes (#37621) 2025-05-19 18:22:47 -04:00
Fluids Make mopping predicted (and some other stuff) (#38749) 2025-07-09 05:17:55 +02:00
GameObjects/Components Miscellaneous Body Decoupling (#38958) 2025-08-06 15:01:20 -04:00
GameRules Move mind role components to shared (#39606) 2025-08-13 12:51:46 +02:00
Gravity EVENT BASED WEIGHTLESSNESS (#37971) 2025-08-19 14:35:09 -04:00
Guidebook Give jobs & antags prototypes a guide field (#28614) 2024-06-06 05:05:58 -07:00
Hands HandsSystem Refactor (#38438) 2025-06-25 15:13:03 +02:00
Interaction Add water cooler interaction test (#39612) 2025-09-05 19:05:49 +02:00
Internals Mind Role Entities (#31318) 2024-10-10 10:48:56 +02:00
Lathe Fix usages of TryIndex() (#39124) 2025-09-09 18:17:56 +02:00
Linter Replace ValidatePrototypeId uses with ProtoId or EntProtoId (#38814) 2025-07-07 21:57:05 +02:00
Lobby Lobby refactor + species loadouts support (#27576) 2024-05-12 09:18:21 +10:00
Localization Add test that entity prototypes don't use LocIds for name/description (#38234) 2025-06-11 02:47:04 +02:00
Mapping Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
Materials Cleanup: Use `MapSystem.DeleteMap instead of IMapManager.DeleteMap in MaterialPrototypeSpawnsStackMaterialTest` (#35472) 2025-02-24 21:12:25 +01:00
Minds Fix usages of TryIndex() (#39124) 2025-09-09 18:17:56 +02:00
Movement Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
Networking Clean up all missing EntitySystem proxy method uses (#38353) 2025-06-26 16:50:49 -07:00
NPC Allow the creation of recursive HTNs (#30138) 2024-07-30 12:18:53 +10:00
Nutrition Add water cooler interaction test (#39612) 2025-09-05 19:05:49 +02:00
Payload Trigger Refactor (#39034) 2025-08-03 21:20:37 +02:00
Physics Add test for anchored prototypes (#30526) 2024-07-31 21:31:41 +10:00
Power Add basic test of station initial power supply (#29698) 2025-06-01 11:51:37 -04:00
Preferences Mind Role Entities (#31318) 2024-10-10 10:48:56 +02:00
Procedural Remove obsolete TestPair.Pair (#19496) 2023-08-25 10:56:51 +10:00
PrototypeTests Add PrototypeUploadTest (#28522) 2024-06-03 01:21:46 -04:00
Puller Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
Replays Mark all tests that restart rounds as dirty (#21376) 2023-11-01 19:56:07 -07:00
Roles Cleanup: Use `MapSystem.DeleteMap instead of IMapManager.DeleteMap in StartingGearPrototypeStorageTest` (#35474) 2025-02-24 21:26:40 +01:00
Round Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
Serialization Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
Shuttle Refactor map loading & saving 2024-12-23 02:42:17 +13:00
SmartFridge Implement SmartFridge functionality (#38648) 2025-07-20 23:21:28 -04:00
Sprite Add role prototype validation tests (#32801) 2024-10-14 14:05:25 +11:00
Station Move some Station methods into shared (#38976) 2025-08-08 11:22:34 -04:00
Storage Make two inventories not dance around as much when opening/closing them (#35041) 2025-04-19 10:40:49 -04:00
Strip Strip drag drop test (#30754) 2024-08-08 12:12:01 +10:00
Tag Cleans up tag system (#28272) 2024-06-02 11:11:19 +10:00
Tiles HandsSystem Refactor (#38438) 2025-06-25 15:13:03 +02:00
Toolshed Toolshed refactor (#33598) 2024-12-21 17:45:48 +11:00
UserInterface refactor: simple radial menu for easier creation (#34639) 2025-03-31 12:57:47 +03:00
Utility Add EntityWhitelistSystem (#27632) 2024-05-03 10:10:15 +10:00
Vending Validate ProtoIds in tests (#38745) 2025-07-04 22:48:55 +02:00
Weldable Add StorageInteractionTest (#28541) 2024-06-03 17:05:51 -04:00
Wires Fix wire layout inheritance. (#26289) 2024-03-20 16:22:47 +01:00
CargoTest.cs Remove BodyComponent check from MobPrice test (#39786) 2025-08-20 12:25:53 -07:00
ClickableTest.cs Cleanup more SpriteComponent warnings (part 5) (#37590) 2025-05-19 03:09:47 +02:00
ConfigPresetTests.cs Fix ConfigPresetTests.TestLoadAll not handling automatic panic bunker (#23414) 2024-01-02 19:08:50 -08:00
ContainerOcclusionTest.cs Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
ContrabandTest.cs Fix usages of TryIndex() (#39124) 2025-09-09 18:17:56 +02:00
DeleteInventoryTest.cs Remove obsolete PoolManager methods (#19499) 2023-08-25 12:13:11 +10:00
DummyIconTest.cs Cleanup 2 SpriteComponent.GetPrototypeTextures uses (#38263) 2025-06-11 11:15:47 -07:00
EntityTest.cs Increase SpawnAndDeleteAllEntitiesOnDifferentMaps test simulation time (#38901) 2025-07-23 03:21:10 +02:00
FillLevelSpriteTest.cs Add an integration test for solution fill level sprites. (#28564) 2024-06-04 10:23:43 +10:00
FollowerSystemTest.cs Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
GravityGridTest.cs EVENT BASED WEIGHTLESSNESS (#37971) 2025-08-19 14:35:09 -04:00
HumanInventoryUniformSlotsTest.cs Cleanup: Use `MapSystem.DeleteMap instead of IMapManager.DeleteMap in HumanInventoryUniformSlotsTest` (#35469) 2025-02-24 21:10:09 +01:00
InventoryHelpersTest.cs Stunnable New Status and Cleanup (#38618) 2025-07-21 19:22:11 +02:00
LogErrorTest.cs Remove obsolete TestPair.Pair (#19496) 2023-08-25 10:56:51 +10:00
MachineBoardTest.cs Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
MagazineVisualsSpriteTest.cs Cleanup more SpriteComponent warnings (part 2) (#37527) 2025-05-17 13:29:03 +10:00
MappingEditorTest.cs Add mapping editor (#23427) 2024-08-04 13:31:45 +10:00
MaterialArbitrageTest.cs CompFactory updates (#37559) 2025-05-20 01:08:55 -04:00
PostMapInitTest.cs Fix usages of TryIndex() (#39124) 2025-09-09 18:17:56 +02:00
PrototypeSaveTest.cs Sloth's subfloor vismask adventure (#35347) 2025-03-21 00:57:04 +11:00
ResearchTest.cs move lathe recipes into packs (easier for forks and maintaining) (#33095) 2025-02-07 19:22:49 +01:00
ResettingEntitySystemTests.cs fix antag selection being evil (#28197) 2024-05-26 01:14:29 -04:00
RestartRoundTest.cs Mark all tests that restart rounds as dirty (#21376) 2023-11-01 19:56:07 -07:00
RoundEndTest.cs Fix RoundEndTest obsolete warnings (#39133) 2025-07-22 10:22:50 -04:00
SalvageTest.cs Refactor map loading & saving 2024-12-23 02:42:17 +13:00
SaveLoadMapTest.cs Refactor map loading & saving (#34020) 2025-02-16 21:36:35 +11:00
SaveLoadSaveTest.cs Moar engine changes 2024-12-24 18:57:52 +13:00
ShuttleTest.cs Code Cleanup: Integration Tests (#29584) 2024-07-03 10:01:37 +10:00
StartTest.cs Remove obsolete TestPair.Pair (#19496) 2023-08-25 10:56:51 +10:00
StorageTest.cs CompFactory updates (#37559) 2025-05-20 01:08:55 -04:00
StoreTests.cs Fix StoreTests EventBus usage (#38489) 2025-08-02 17:23:44 +02:00
VendingMachineRestockTest.cs Validate ProtoIds in tests (#38745) 2025-07-04 22:48:55 +02:00
XenoArtifactTest.cs 3mo xeno archeology (first phase) (#33370) 2025-04-15 10:34:53 +10:00