Need to fix index load issues
This commit is contained in:
@@ -14,7 +14,7 @@ namespace SVSim.UnitTests.Controllers;
|
||||
public class LoadControllerTests
|
||||
{
|
||||
private const string IndexRequestJson =
|
||||
"""{"viewerId":"0","steamId":0,"steamSessionTicket":"","carrier":"steam","cardMasterHash":""}""";
|
||||
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","carrier":"steam","card_master_hash":""}""";
|
||||
|
||||
/// <summary>
|
||||
/// JSON keys (camelCased C# property names) for fields the client reads unconditionally.
|
||||
@@ -25,17 +25,17 @@ public class LoadControllerTests
|
||||
/// </summary>
|
||||
private static readonly string[] RequiredIndexKeys =
|
||||
{
|
||||
"userTutorial", "userInfo", "userCurrency", "userItems",
|
||||
"userRotationDecks", "userUnlimitedDecks", "userMyRotationDecks",
|
||||
"userCards", "userClasses", "sleeves", "userEmblems",
|
||||
"userDegrees", "leaderSkins", "myPageBackgrounds",
|
||||
"userRankInfo", "userRankedMatches", "dailyLoginBonus", "arenaConfig",
|
||||
"redEtherOverrides", "maintenanceCards", "arenaInfos", "rankInfo",
|
||||
"classExp", "loadingTipCardExclusions", "defaultSettings",
|
||||
"unlimitedBanList", "rotationSets",
|
||||
"reprintedCards", "spotCards", "featureMaintenances",
|
||||
"specialCrystalInfos", "openBattlefieldIds", "lootBoxRegulations",
|
||||
"gatheringInfo", "userConfig", "deckFormat", "cardSetIdForResourceDlView"
|
||||
"user_tutorial", "user_info", "user_currency", "user_items",
|
||||
"user_rotation_decks", "user_unlimited_decks", "user_my_rotation_decks",
|
||||
"user_cards", "user_classes", "sleeves", "user_emblems",
|
||||
"user_degrees", "leader_skins", "my_page_backgrounds",
|
||||
"user_rank_info", "user_ranked_matches", "daily_login_bonus", "arena_config",
|
||||
"red_ether_overrides", "maintenance_cards", "arena_infos", "rank_info",
|
||||
"class_exp", "loading_tip_card_exclusions", "default_settings",
|
||||
"unlimited_ban_list", "rotation_sets",
|
||||
"reprinted_cards", "spot_cards", "feature_maintenances",
|
||||
"special_crystal_infos", "open_battlefield_ids", "loot_box_regulations",
|
||||
"gathering_info", "user_config", "deck_format", "card_set_id_for_resource_dl_view"
|
||||
};
|
||||
|
||||
private static async Task<JsonElement> PostIndexAndReadBody(SVSimTestFactory factory, long viewerId)
|
||||
@@ -100,7 +100,7 @@ public class LoadControllerTests
|
||||
|
||||
var root = await PostIndexAndReadBody(factory, viewerId);
|
||||
|
||||
Assert.That(root.GetProperty("userRankInfo").ValueKind, Is.EqualTo(JsonValueKind.Array));
|
||||
Assert.That(root.GetProperty("user_rank_info").ValueKind, Is.EqualTo(JsonValueKind.Array));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -114,7 +114,7 @@ public class LoadControllerTests
|
||||
|
||||
var root = await PostIndexAndReadBody(factory, viewerId);
|
||||
|
||||
Assert.That(root.GetProperty("userRankInfo").GetArrayLength(), Is.EqualTo(5));
|
||||
Assert.That(root.GetProperty("user_rank_info").GetArrayLength(), Is.EqualTo(5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -127,7 +127,7 @@ public class LoadControllerTests
|
||||
|
||||
var root = await PostIndexAndReadBody(factory, viewerId);
|
||||
|
||||
Assert.That(root.GetProperty("rotationSets").GetArrayLength(),
|
||||
Assert.That(root.GetProperty("rotation_sets").GetArrayLength(),
|
||||
Is.GreaterThanOrEqualTo(2));
|
||||
}
|
||||
|
||||
@@ -141,12 +141,12 @@ public class LoadControllerTests
|
||||
|
||||
var root = await PostIndexAndReadBody(factory, viewerId);
|
||||
|
||||
foreach (var key in new[] { "userRotationDecks", "userUnlimitedDecks", "userMyRotationDecks" })
|
||||
foreach (var key in new[] { "user_rotation_decks", "user_unlimited_decks", "user_my_rotation_decks" })
|
||||
{
|
||||
var container = root.GetProperty(key);
|
||||
Assert.That(container.ValueKind, Is.EqualTo(JsonValueKind.Object),
|
||||
$"{key} should be the UserFormatDeckInfo object wrapper, not a raw array.");
|
||||
var inner = container.GetProperty("userDecks");
|
||||
var inner = container.GetProperty("user_decks");
|
||||
Assert.That(inner.ValueKind, Is.EqualTo(JsonValueKind.Array));
|
||||
Assert.That(inner.GetArrayLength(), Is.EqualTo(0),
|
||||
$"{key}.userDecks must be an empty array for a deckless viewer, not null.");
|
||||
|
||||
Reference in New Issue
Block a user