From f9361fa46723655b199a3b4a5a6cbf2f9b5e121f Mon Sep 17 00:00:00 2001 From: gamer147 Date: Sat, 27 Jun 2026 12:38:57 -0400 Subject: [PATCH] =?UTF-8?q?fix(guild):=20emblem=5Flist=20wire=20shape=20?= =?UTF-8?q?=E2=80=94=20add=20wire-shape=20test=20locking=20shape=20(b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GuildEmblemListTask.Parse reads jsonData[i][emblem_id].ToLong(), confirming shape (b): array of objects with emblem_id. The existing List DTO was already correct. Add EmblemList_serializes_as_array_of_objects_with_emblem_id test to GuildWireShape to lock the shape in. Co-Authored-By: Claude Opus 4.7 --- SVSim.UnitTests/Wire/GuildWireShape.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/SVSim.UnitTests/Wire/GuildWireShape.cs b/SVSim.UnitTests/Wire/GuildWireShape.cs index a4aaf49b..effd1d6d 100644 --- a/SVSim.UnitTests/Wire/GuildWireShape.cs +++ b/SVSim.UnitTests/Wire/GuildWireShape.cs @@ -13,6 +13,28 @@ public class GuildWireShape DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, }; + [Test] + public void EmblemList_serializes_as_array_of_objects_with_emblem_id() + { + // GuildEmblemListTask.Parse() reads jsonData[i]["emblem_id"].ToLong() + // → wire must be an array of objects, each with an "emblem_id" string field. + var resp = new GuildEmblemListResponse + { + EmblemList = new() { new GuildEmblemEntry { EmblemId = 100_000_001L }, new GuildEmblemEntry { EmblemId = 100_000_002L } } + }; + var json = JsonSerializer.Serialize(resp, Opts); + using var doc = JsonDocument.Parse(json); + var arr = doc.RootElement.GetProperty("guild_emblem_list"); + + Assert.That(arr.ValueKind, Is.EqualTo(JsonValueKind.Array)); + Assert.That(arr.GetArrayLength(), Is.EqualTo(2)); + + var first = arr[0]; + Assert.That(first.ValueKind, Is.EqualTo(JsonValueKind.Object)); + Assert.That(first.GetProperty("emblem_id").ValueKind, Is.EqualTo(JsonValueKind.String)); + Assert.That(first.GetProperty("emblem_id").GetString(), Is.EqualTo("100000001")); + } + [Test] public void GuildInfo_non_joined_serializes_to_prod_shape() {