From 0cbbc70872f93511dc80c01aa7806d396241f293 Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Fri, 16 Feb 2024 13:10:28 +0000 Subject: [PATCH] Fix Crime Assist incorrect entires and add a test (#624) * Create CrimeassistTest.cs * Fix invalid crimeasssist entries * Clean up test code (cherry picked from commit c66677797c44e6d6b6af976082ed977a7cdcb0b9) --- .../Tests/DeltaV/CrimeassistTest.cs | 79 +++++++++++++++++++ .../DeltaV/cartridges/crimeassistflow.yml | 23 ++++-- 2 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 Content.IntegrationTests/Tests/DeltaV/CrimeassistTest.cs diff --git a/Content.IntegrationTests/Tests/DeltaV/CrimeassistTest.cs b/Content.IntegrationTests/Tests/DeltaV/CrimeassistTest.cs new file mode 100644 index 00000000000000..2e5c7605fa8c6d --- /dev/null +++ b/Content.IntegrationTests/Tests/DeltaV/CrimeassistTest.cs @@ -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(); + var allProtos = prototypeManager.EnumeratePrototypes().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(); + } +} diff --git a/Resources/Prototypes/DeltaV/cartridges/crimeassistflow.yml b/Resources/Prototypes/DeltaV/cartridges/crimeassistflow.yml index c4cb604422c2bf..c8258ba598cc1e 100644 --- a/Resources/Prototypes/DeltaV/cartridges/crimeassistflow.yml +++ b/Resources/Prototypes/DeltaV/cartridges/crimeassistflow.yml @@ -120,7 +120,7 @@ - type: crimeAssistPage id: "questionWasCrimeSexualInNature" locKey: "crime-assist-question-wascrimesexualinnature" - onYes: "resultSexualHarrassment" + onYes: "resultSexualHarassment" onNo: "questionWasSuspectANuisance" - type: crimeAssistPage @@ -278,12 +278,19 @@ locKeySeverity: "crime-assist-crimetype-felony" locKeyPunishment: "crime-assist-crimepunishment-contemptofcourt" +- type: crimeAssistPage + id: "resultBlackMarketeering" + locKeyTitle: "crime-assist-crime-blackmarketeering" + locKeyDescription: "crime-assist-crimedetail-blackmarketeering" + locKeySeverity: "crime-assist-crimetype-felony" + locKeyPunishment: "crime-assist-crimepunishment-blackmarketeering" + - type: crimeAssistPage id: "resultPerjuryOrFalseReport" - locKeyTitle: "crime-assist-crime-perjuryorfalsereport" - locKeyDescription: "crime-assist-crimedetail-perjuryorfalsereport" + locKeyTitle: "crime-assist-crime-perjuryfalsereport" + locKeyDescription: "crime-assist-crimedetail-perjuryfalsereport" locKeySeverity: "crime-assist-crimetype-felony" - locKeyPunishment: "crime-assist-crimepunishment-perjuryorfalsereport" + locKeyPunishment: "crime-assist-crimepunishment-perjuryfalsereport" - type: crimeAssistPage id: "resultObstructionOfJustice" @@ -335,8 +342,8 @@ locKeyPunishment: "crime-assist-crimepunishment-sedition" - type: crimeAssistPage - id: "resultSexualHarrassment" - locKeyTitle: "crime-assist-crime-sexualharrassment" - locKeyDescription: "crime-assist-crimedetail-sexualharrassment" + id: "resultSexualHarassment" + locKeyTitle: "crime-assist-crime-sexualharassment" + locKeyDescription: "crime-assist-crimedetail-sexualharassment" locKeySeverity: "crime-assist-crimetype-capital" - locKeyPunishment: "crime-assist-crimepunishment-sexualharrassment" + locKeyPunishment: "crime-assist-crimepunishment-sexualharassment"