diff --git a/SVSim.UnitTests/Controllers/FreeBattleControllerTests.cs b/SVSim.UnitTests/Controllers/FreeBattleControllerTests.cs index f57dd599..4c8c252f 100644 --- a/SVSim.UnitTests/Controllers/FreeBattleControllerTests.cs +++ b/SVSim.UnitTests/Controllers/FreeBattleControllerTests.cs @@ -169,4 +169,42 @@ public class FreeBattleControllerTests Assert.That(doc.RootElement.EnumerateObject().MoveNext(), Is.False, "Body should be {} — defensive no-op for dead URL."); } + + [Test] + public async Task DoMatching_unlimited_accepts_literal_prod_request_keys() + { + await using var factory = new SVSimTestFactory(); + var viewerId = await factory.SeedViewerAsync(); + await factory.SeedGlobalsAsync(); + await factory.SeedDeckAsync(viewerId, Format.Unlimited, 7); + var client = factory.CreateAuthenticatedClient(viewerId); + + // Body shape lifted from a real prod capture (traffic_prod_ranked_unlimited.ndjson + // line 73). Exercises every wire key the client emits on this URL. + var literalProdBody = new + { + deck_no = 7, + need_init = 0, + log = 2, + excluded_field_id_list = Array.Empty(), + use_stage_select = 1, + is_default_skin = 0, + // Auth placeholders — TestAuthHandler injects the real viewer-id via header. + viewer_id = "0", + steam_id = 0, + steam_session_ticket = "", + }; + + var resp = await client.PostAsJsonAsync("/unlimited_free_battle/do_matching", literalProdBody); + + Assert.That(resp.IsSuccessStatusCode, Is.True, $"Expected 2xx, got {resp.StatusCode}"); + using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync()); + var data = doc.RootElement; + // First poll on an empty queue → 3002 RETRY. + Assert.That(data.GetProperty("matching_state").GetInt32(), Is.EqualTo(3002)); + Assert.That(data.GetProperty("node_server_url").GetString(), Is.EqualTo("")); + // timeout_period + retry_period are always present. + Assert.That(data.TryGetProperty("timeout_period", out _), Is.True); + Assert.That(data.TryGetProperty("retry_period", out _), Is.True); + } }