Refactor guide entry tests. (#43159)

* Add 204 more tests.

* better plan.
This commit is contained in:
Moony 2026-03-10 19:22:17 +01:00 committed by Coryler
parent 5aec92445a
commit 13900c9ffb
2 changed files with 14 additions and 14 deletions

View File

@ -2,8 +2,9 @@ using Content.Client.Guidebook;
using Content.Client.Guidebook.Richtext;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using System.Linq;
using Content.IntegrationTests.Utility;
using Content.Shared.Guidebook;
using Robust.Shared.Localization;
namespace Content.IntegrationTests.Tests.Guidebook;
@ -13,8 +14,12 @@ namespace Content.IntegrationTests.Tests.Guidebook;
[TestOf(typeof(DocumentParsingManager))]
public sealed class GuideEntryPrototypeTests
{
private static string[] _guideEntries = GameDataScrounger.PrototypesOfKind<GuideEntryPrototype>();
[Test]
public async Task ValidatePrototypeContents()
[TestCaseSource(nameof(_guideEntries))]
[Description("Ensures a given guidebook entry is valid, checking the document/etc.")]
public async Task Validate(string protoKey)
{
return; // DeltaV - shit broken
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
@ -23,20 +28,15 @@ public sealed class GuideEntryPrototypeTests
var protoMan = client.ResolveDependency<IPrototypeManager>();
var resMan = client.ResolveDependency<IResourceManager>();
var parser = client.ResolveDependency<DocumentParsingManager>();
var prototypes = protoMan.EnumeratePrototypes<GuideEntryPrototype>().ToList();
var proto = protoMan.Index<GuideEntryPrototype>(protoKey);
foreach (var proto in prototypes)
await client.WaitAssertion(() =>
{
await client.WaitAssertion(() =>
{
using var reader = resMan.ContentFileReadText(proto.Text);
var text = reader.ReadToEnd();
Assert.That(parser.TryAddMarkup(new Document(), text), $"Failed to parse guidebook: {proto.Id}");
});
using var reader = resMan.ContentFileReadText(proto.Text);
var text = reader.ReadToEnd();
// Avoid styleguide update limit
await client.WaitRunTicks(1);
}
Assert.That(parser.TryAddMarkup(new Document(), text), $"Failed to parse the guide entry's document.");
});
await pair.CleanReturnAsync();
}

View File

@ -26,7 +26,7 @@ public class GuideEntry
/// <summary>
/// The name of this guide. This gets localized.
/// </summary>
[DataField(required: true)] public string Name = default!;
[DataField(required: true)] public LocId Name = default!;
/// <summary>
/// The "children" of this guide for when guides are shown in a tree / table of contents.