diff --git a/Content.IntegrationTests/Tests/_DV/RoboisseurTest.cs b/Content.IntegrationTests/Tests/_DV/RoboisseurTest.cs index ce4781d2a9..b78a44beff 100644 --- a/Content.IntegrationTests/Tests/_DV/RoboisseurTest.cs +++ b/Content.IntegrationTests/Tests/_DV/RoboisseurTest.cs @@ -1,8 +1,6 @@ -using System.Linq; using Content.Server.Roboisseur.Roboisseur; using Content.Shared.Item; using Robust.Shared.GameObjects; -using Robust.Shared.Map; using Robust.Shared.Prototypes; namespace Content.IntegrationTests.Tests._DV; @@ -12,57 +10,39 @@ namespace Content.IntegrationTests.Tests._DV; public sealed class RoboisseurTest { [Test] - public async Task AllRoboisseurItemsExist() + public async Task AllRoboisseurRewardsAreItems() { await using var pair = await PoolManager.GetServerClient(); var server = pair.Server; // Per RobustIntegrationTest.cs, wait until state is settled to access it. await server.WaitIdleAsync(); - var mapManager = server.ResolveDependency(); - var prototypeManager = server.ResolveDependency(); - var entityManager = server.ResolveDependency(); - var entitySystemManager = server.ResolveDependency(); + var protoMan = server.ResolveDependency(); + var factory = server.ResolveDependency(); - var roboisseurSystem = entitySystemManager.GetEntitySystem(); - var roboisseurComponent = new RoboisseurComponent(); - - var testMap = await pair.CreateTestMap(); + // TODO: spawn the actual prototype and get the component from it + var comp = new RoboisseurComponent(); await server.WaitAssertion(() => { - var allProtos = roboisseurComponent.Tier2Protos.Concat(roboisseurComponent.Tier3Protos) - .Concat(roboisseurComponent.RobossuierRewards); - var enumerable = allProtos as string[] ?? allProtos.ToArray(); - var blacklistedProtos = roboisseurComponent.BlacklistedProtos; - var coordinates = testMap.GridCoords; - - Assert.That(enumerable.Any(), "Roboisseur has no valid prototypes!"); - - foreach (var proto in enumerable) + Assert.Multiple(() => { - Assert.That(prototypeManager.TryIndex(proto, out var _), - $"Roboisseur has invalid prototype {proto}!"); - - var spawned = entityManager.SpawnEntity(proto, coordinates); - - Assert.That(entityManager.HasComponent(spawned), - $"Roboisseur can request non-item {proto}"); - } - - foreach (var proto in blacklistedProtos) - { - Assert.That(prototypeManager.TryIndex(proto, out var _), - $"Roboisseur has invalid prototype {proto} in blacklist!"); - } - - // Because Server/Client pairs can be re-used between Tests, we - // need to clean up anything that might affect other tests, - // otherwise this pair cannot be considered clean, and the - // CleanReturnAsync call would need to be removed. - mapManager.DeleteMap(testMap.MapId); + Check(comp.Tier2Protos, protoMan, factory); + Check(comp.Tier3Protos, protoMan, factory); + Check(comp.RobossuierRewards, protoMan, factory); + }); }); await pair.CleanReturnAsync(); } + + private void Check(List protos, IPrototypeManager protoMan, IComponentFactory factory) + { + foreach (var id in protos) + { + var proto = protoMan.Index(id); + var isItem = proto.TryGetComponent(out _, factory); + Assert.That(isItem, $"Roboisseur can request non-item {id}"); + } + } }