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:
committed by
GitHub
parent
bc5812dd7b
commit
033f8444ba
41
Content.IntegrationTests/Tests/ContrabandTest.cs
Normal file
41
Content.IntegrationTests/Tests/ContrabandTest.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: Contraband
|
- type: Contraband
|
||||||
severity: Restricted
|
severity: Restricted
|
||||||
|
allowedDepartments: [ Security ]
|
||||||
|
|
||||||
# one department restricted contraband
|
# one department restricted contraband
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user