-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Requested changes but need assistance with test fail
- Loading branch information
Showing
6 changed files
with
85 additions
and
28 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
Content.IntegrationTests/Tests/Nyanotrasen/Metempsychosis/MetempsychosisTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System.Linq; | ||
using Content.Server.Nyanotrasen.Cloning; | ||
using Content.Shared.Random; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.IntegrationTests.Tests.DeltaV; | ||
|
||
[TestFixture] | ||
[TestOf(typeof(MetempsychoticMachineSystem))] | ||
public sealed class MetempsychosisTest | ||
{ | ||
private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
[Test] | ||
public async Task AllHumanoidPoolSpeciesExist() | ||
{ | ||
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<IMapManager>(); | ||
var prototypeManager = server.ResolveDependency<IPrototypeManager>(); | ||
var entityManager = server.ResolveDependency<IEntityManager>(); | ||
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>(); | ||
|
||
var metemSystem = entitySystemManager.GetEntitySystem<MetempsychoticMachineSystem>(); | ||
var metemComponent = new MetempsychoticMachineComponent(); | ||
|
||
var testMap = await pair.CreateTestMap(); | ||
|
||
await server.WaitAssertion(() => | ||
{ | ||
_prototypeManager.TryIndex<WeightedRandomPrototype>(metemComponent.MetempsychoticHumanoidPool, out var humanoidPool); | ||
_prototypeManager.TryIndex<WeightedRandomPrototype>(metemComponent.MetempsychoticNonHumanoidPool, out var nonHumanoidPool); | ||
|
||
var coordinates = testMap.GridCoords; | ||
|
||
Assert.That(humanoidPool.Weights.Any(), "MetempsychoticHumanoidPool has no valid prototypes!"); | ||
Assert.That(nonHumanoidPool.Weights.Any(), "MetempsychoticNonHumanoidPool has no valid prototypes!"); | ||
|
||
foreach (var (key, weight) in humanoidPool.Weights) | ||
{ | ||
Assert.That(prototypeManager.TryIndex(key, out var _), | ||
$"MetempsychoticHumanoidPool has invalid prototype {key}!"); | ||
|
||
var spawned = entityManager.SpawnEntity(key, coordinates); | ||
} | ||
|
||
foreach (var (key, weight) in nonHumanoidPool.Weights) | ||
{ | ||
Assert.That(prototypeManager.TryIndex(key, out var _), | ||
$"MetempsychoticNonHumanoidPool has invalid prototype {key}!"); | ||
|
||
var spawned = entityManager.SpawnEntity(key, coordinates); | ||
} | ||
|
||
// 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); | ||
}); | ||
await pair.CleanReturnAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters