added missing allowed department to the restricted severity (#34558)

* added missing allow job to the base restricted severity

* no need to make a list

* no more linq in ContrabandTest

* less nesting in ContrabandTest
This commit is contained in:
Ignaz "Ian" Kraft
2025-01-23 15:01:45 +01:00
committed by GitHub
parent bc5812dd7b
commit 033f8444ba
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
using Content.Shared.Contraband;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests;
[TestFixture]
public sealed class ContrabandTest
{
[Test]
public async Task EntityShowDepartmentsAndJobs()
{
await using var pair = await PoolManager.GetServerClient();
var client = pair.Client;
var protoMan = client.ResolveDependency<IPrototypeManager>();
var componentFactory = client.ResolveDependency<IComponentFactory>();
await client.WaitAssertion(() =>
{
foreach (var proto in protoMan.EnumeratePrototypes<EntityPrototype>())
{
if (proto.Abstract || pair.IsTestPrototype(proto))
continue;
if (!proto.TryGetComponent<ContrabandComponent>(out var contraband, componentFactory))
continue;
Assert.That(protoMan.TryIndex(contraband.Severity, out var severity, false),
@$"{proto.ID} has a ContrabandComponent with a unknown severity.");
if (!severity.ShowDepartmentsAndJobs)
continue;
Assert.That(contraband.AllowedDepartments.Count + contraband.AllowedJobs.Count, Is.Not.EqualTo(0),
@$"{proto.ID} has a ContrabandComponent with ShowDepartmentsAndJobs but no allowed departments or jobs.");
}
});
await pair.CleanReturnAsync();
}
}