]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make cargo arbitrage test ignore gambling crate (#22943)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Mon, 25 Dec 2023 07:15:33 +0000 (02:15 -0500)
committerGitHub <noreply@github.com>
Mon, 25 Dec 2023 07:15:33 +0000 (00:15 -0700)
Content.IntegrationTests/Tests/CargoTest.cs

index 66135279d57fb38dc14d544b208b7fbcce84f4ef..055a21ccfd6ca1e8d45a78c8750d356ecb004965 100644 (file)
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
 using System.Linq;
 using System.Numerics;
 using Content.Server.Cargo.Components;
@@ -6,7 +7,6 @@ using Content.Shared.Cargo.Prototypes;
 using Content.Shared.Stacks;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Map;
-using Robust.Shared.Maths;
 using Robust.Shared.Prototypes;
 
 namespace Content.IntegrationTests.Tests;
@@ -14,6 +14,12 @@ namespace Content.IntegrationTests.Tests;
 [TestFixture]
 public sealed class CargoTest
 {
+    public static HashSet<ProtoId<CargoProductPrototype>> Ignored = new ()
+    {
+        // This is ignored because it is explicitly intended to be able to sell for more than it costs.
+        new("FunCrateGambling")
+    };
+
     [Test]
     public async Task NoCargoOrderArbitrage()
     {
@@ -23,27 +29,25 @@ public sealed class CargoTest
         var testMap = await pair.CreateTestMap();
 
         var entManager = server.ResolveDependency<IEntityManager>();
-        var mapManager = server.ResolveDependency<IMapManager>();
         var protoManager = server.ResolveDependency<IPrototypeManager>();
         var pricing = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<PricingSystem>();
 
         await server.WaitAssertion(() =>
         {
-            var mapId = testMap.MapId;
-
             Assert.Multiple(() =>
             {
                 foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
                 {
-                    var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
+                    if (Ignored.Contains(proto.ID))
+                        continue;
+
+                    var ent = entManager.SpawnEntity(proto.Product, testMap.MapCoords);
                     var price = pricing.GetPrice(ent);
 
                     Assert.That(price, Is.AtMost(proto.PointCost), $"Found arbitrage on {proto.ID} cargo product! Cost is {proto.PointCost} but sell is {price}!");
                     entManager.DeleteEntity(ent);
                 }
             });
-
-            mapManager.DeleteMap(mapId);
         });
 
         await pair.CleanReturnAsync();