-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Crime Assist incorrect entires and add a test (#624)
* Create CrimeassistTest.cs * Fix invalid crimeasssist entries * Clean up test code
- Loading branch information
Showing
2 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
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,79 @@ | ||
using System.Linq; | ||
using Content.Shared.DeltaV.CartridgeLoader.Cartridges; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.Localization; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.IntegrationTests.Tests.DeltaV; | ||
|
||
[TestFixture] | ||
public sealed class CrimeAssistTest | ||
{ | ||
[Test] | ||
public async Task CrimeAssistValid() | ||
{ | ||
await using var pair = await PoolManager.GetServerClient(); | ||
var server = pair.Server; | ||
await server.WaitIdleAsync(); | ||
|
||
var prototypeManager = server.ResolveDependency<IPrototypeManager>(); | ||
var allProtos = prototypeManager.EnumeratePrototypes<CrimeAssistPage>().ToArray(); | ||
|
||
await server.WaitAssertion(() => | ||
{ | ||
foreach (var proto in allProtos) | ||
{ | ||
if (proto.LocKey != null) | ||
{ | ||
Assert.That(Loc.TryGetString(proto.LocKey, out var _), | ||
$"CrimeAssistPage {proto.ID} has invalid LocKey {proto.LocKey}!"); | ||
} | ||
|
||
if (proto.LocKeyTitle != null) | ||
{ | ||
Assert.That(Loc.TryGetString(proto.LocKeyTitle, out var _), | ||
$"CrimeAssistPage {proto.ID} has invalid LocKeyTitle {proto.LocKeyTitle}!"); | ||
} | ||
|
||
if (proto.LocKeyDescription != null) | ||
{ | ||
Assert.That(Loc.TryGetString(proto.LocKeyDescription, out var _), | ||
$"CrimeAssistPage {proto.ID} has invalid LocKeyDescription {proto.LocKeyDescription}!"); | ||
} | ||
|
||
if (proto.LocKeySeverity != null) | ||
{ | ||
Assert.That(Loc.TryGetString(proto.LocKeySeverity, out var _), | ||
$"CrimeAssistPage {proto.ID} has invalid LocKeySeverity {proto.LocKeySeverity}!"); | ||
} | ||
|
||
if (proto.LocKeyPunishment != null) | ||
{ | ||
Assert.That(Loc.TryGetString(proto.LocKeyPunishment, out var _), | ||
$"CrimeAssistPage {proto.ID} has invalid LocKeyPunishment {proto.LocKeyPunishment}!"); | ||
} | ||
|
||
if (proto.OnStart != null) | ||
{ | ||
Assert.That(allProtos.Any(p => p.ID == proto.OnStart), | ||
$"CrimeAssistPage {proto.ID} has invalid OnStart {proto.OnStart}!"); | ||
} | ||
|
||
if (proto.OnYes != null) | ||
{ | ||
Assert.That(allProtos.Any(p => p.ID == proto.OnYes), | ||
$"CrimeAssistPage {proto.ID} has invalid OnYes {proto.OnYes}!"); | ||
} | ||
|
||
if (proto.OnNo != null) | ||
{ | ||
Assert.That(allProtos.Any(p => p.ID == proto.OnNo), | ||
$"CrimeAssistPage {proto.ID} has invalid OnNo {proto.OnNo}!"); | ||
} | ||
} | ||
}); | ||
|
||
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