Add validation test for ExplosionPrototypes (#37621)

* Add validation test for ExplosionPrototype

* Remove runtime validation in prototype
This commit is contained in:
Tayrtahn
2025-05-19 18:22:47 -04:00
committed by GitHub
parent 004e084b5a
commit 6e4e2d0b69
2 changed files with 31 additions and 9 deletions

View File

@@ -0,0 +1,28 @@
using Content.Shared.Explosion;
namespace Content.IntegrationTests.Tests.Explosion;
public sealed class ExplosionPrototypeTest
{
[Test]
public async Task ValidateExplosionPrototypes()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var protos = protoMan.EnumeratePrototypes<ExplosionPrototype>();
Assert.Multiple(() =>
{
foreach (var proto in protos)
{
Assert.That(proto._tileBreakChance, Is.Not.Empty, $"Empty tile break chance definitions for explosion prototype: {proto.ID}");
Assert.That(proto._tileBreakChance, Has.Length.EqualTo(proto._tileBreakIntensity.Length), $"Malformed tile break chance definitions for explosion prototype: {proto.ID}");
}
});
await pair.CleanReturnAsync();
}
}