Need to fix index load issues

This commit is contained in:
gamer147
2026-05-23 14:50:16 -04:00
parent bf6ddf5428
commit 631e42289a
12 changed files with 351 additions and 119 deletions

View File

@@ -13,10 +13,10 @@ namespace SVSim.UnitTests.Controllers;
public class CheckControllerTests
{
private const string BaseRequestJson =
"""{"viewerId":"0","steamId":0,"steamSessionTicket":""}""";
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":""}""";
private const string GameStartRequestJson =
"""{"viewerId":"0","steamId":0,"steamSessionTicket":"","appType":0,"campaignData":"","campaignSign":"","campaignUser":0}""";
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","app_type":0,"campaign_data":"","campaign_sign":"","campaign_user":0}""";
[Test]
public async Task SpecialTitle_returns_default_title_id()
@@ -31,7 +31,7 @@ public class CheckControllerTests
var body = await response.Content.ReadAsStringAsync();
using var doc = JsonDocument.Parse(body);
Assert.That(doc.RootElement.GetProperty("titleImageId").GetString(), Is.EqualTo("0"));
Assert.That(doc.RootElement.GetProperty("title_image_id").GetString(), Is.EqualTo("0"));
}
[Test]
@@ -51,30 +51,30 @@ public class CheckControllerTests
var root = doc.RootElement;
// now_tutorial_step is a STRING on the wire (prod sends "100"); client calls .ToInt().
Assert.That(root.GetProperty("nowTutorialStep").GetString(), Is.EqualTo("100"),
Assert.That(root.GetProperty("now_tutorial_step").GetString(), Is.EqualTo("100"),
"RegisterViewer's seed-config default sets tutorial_state=100 (tutorial complete).");
Assert.That(root.GetProperty("tosState").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("policyState").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("korAuthorityState").GetInt32(), Is.EqualTo(0));
Assert.That(root.GetProperty("tosId").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("policyId").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("korAuthorityId").GetInt32(), Is.EqualTo(0));
Assert.That(root.GetProperty("tos_state").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("policy_state").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("kor_authority_state").GetInt32(), Is.EqualTo(0));
Assert.That(root.GetProperty("tos_id").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("policy_id").GetInt32(), Is.EqualTo(1));
Assert.That(root.GetProperty("kor_authority_id").GetInt32(), Is.EqualTo(0));
// Prod-shape fields (not strictly read by GameStartCheckTask.Parse but sent by prod).
Assert.That(root.GetProperty("nowViewerId").GetInt64(), Is.GreaterThan(0));
Assert.That(root.GetProperty("nowName").GetString(), Is.Not.Empty);
Assert.That(root.GetProperty("nowRank").ValueKind, Is.EqualTo(JsonValueKind.Object));
Assert.That(root.GetProperty("now_viewer_id").GetInt64(), Is.GreaterThan(0));
Assert.That(root.GetProperty("now_name").GetString(), Is.Not.Empty);
Assert.That(root.GetProperty("now_rank").ValueKind, Is.EqualTo(JsonValueKind.Object));
// Steam connection should round-trip into transition_account_data — all three fields
// serialized as strings (matches prod wire shape).
var transitions = root.GetProperty("transitionAccountData");
var transitions = root.GetProperty("transition_account_data");
Assert.That(transitions.ValueKind, Is.EqualTo(JsonValueKind.Array));
Assert.That(transitions.GetArrayLength(), Is.EqualTo(1),
"Seeded viewer has exactly one Steam social account connection.");
Assert.That(transitions[0].GetProperty("socialAccountType").GetString(),
Assert.That(transitions[0].GetProperty("social_account_type").GetString(),
Is.EqualTo(((int)SVSim.Database.Enums.SocialAccountType.Steam).ToString()));
Assert.That(transitions[0].GetProperty("socialAccountId").GetString(), Is.Not.Empty);
Assert.That(transitions[0].GetProperty("connectedViewerId").GetString(), Is.Not.Empty);
Assert.That(transitions[0].GetProperty("social_account_id").GetString(), Is.Not.Empty);
Assert.That(transitions[0].GetProperty("connected_viewer_id").GetString(), Is.Not.Empty);
}
[Test]
@@ -97,9 +97,9 @@ public class CheckControllerTests
using var doc = JsonDocument.Parse(body);
var root = doc.RootElement;
Assert.That(root.TryGetProperty("rewriteViewerId", out _), Is.False,
Assert.That(root.TryGetProperty("rewrite_viewer_id", out _), Is.False,
"rewrite_viewer_id must NOT be present in the response — client NREs on null .ToInt().");
Assert.That(root.TryGetProperty("accountDeleteReservationStatus", out _), Is.False,
Assert.That(root.TryGetProperty("account_delete_reservation_status", out _), Is.False,
"account_delete_reservation_status must NOT be present — presence triggers client behavior.");
}