diff --git a/Content.IntegrationTests/Tests/Cloning/CloningSettingsPrototypeTest.cs b/Content.IntegrationTests/Tests/Cloning/CloningSettingsPrototypeTest.cs new file mode 100644 index 0000000000..9edc115eee --- /dev/null +++ b/Content.IntegrationTests/Tests/Cloning/CloningSettingsPrototypeTest.cs @@ -0,0 +1,46 @@ +using Content.Shared.Cloning; + +namespace Content.IntegrationTests.Tests.Cloning; + +public sealed class CloningSettingsPrototypeTest +{ + /// + /// Checks that the components named in every are valid components known to the server. + /// This is used instead of because we only care if the components are registered with the server, + /// and instead of a because we only need component names. + /// + [Test] + public async Task ValidatePrototypes() + { + await using var pair = await PoolManager.GetServerClient(); + var server = pair.Server; + var protoMan = server.ProtoMan; + var compFactory = server.EntMan.ComponentFactory; + + await server.WaitAssertion(() => + { + Assert.Multiple(() => + { + var protos = protoMan.EnumeratePrototypes(); + foreach (var proto in protos) + { + foreach (var compName in proto.Components) + { + Assert.That(compFactory.TryGetRegistration(compName, out _), + $"Failed to find a component named {compName} for {nameof(CloningSettingsPrototype)} \"{proto.ID}\"" + ); + } + + foreach (var eventCompName in proto.EventComponents) + { + Assert.That(compFactory.TryGetRegistration(eventCompName, out _), + $"Failed to find a component named {eventCompName} for {nameof(CloningSettingsPrototype)} \"{proto.ID}\"" + ); + } + } + }); + }); + + await pair.CleanReturnAsync(); + } +}