Things were working, suddenly regressed

This commit is contained in:
gamer147
2026-05-23 18:14:42 -04:00
parent 56d3cf0ec8
commit 66184b3685
31 changed files with 1493 additions and 97 deletions

View File

@@ -2,6 +2,7 @@ using System.Net;
using System.Text;
using System.Text.Json;
using SVSim.Database.Enums;
using SVSim.EmulatedEntrypoint.Extensions;
using SVSim.UnitTests.Infrastructure;
namespace SVSim.UnitTests.Controllers;
@@ -16,8 +17,9 @@ public class PracticeControllerTests
private const string BaseRequestJson =
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":""}""";
// ToApi() converts internal Format -> wire deck_format int (Format.All -> 0, etc.).
private static string DeckFormatRequestJson(Format f) =>
$$"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","deck_format":{{(int)f}}}""";
$$"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","deck_format":{{f.ToApi()}}}""";
[Test]
public async Task Info_returns_non_empty_opponent_array()
@@ -103,8 +105,11 @@ public class PracticeControllerTests
// recoveryData is an opaque JSON blob serialized to string by the client; the server
// is supposed to accept it without validation. Anything goes.
// deck_format:1 = Format.Rotation on the wire. The controller ignores the field today
// (practice is per-format upstream), but sending a coherent wire code keeps the test
// intent clean if Finish ever starts validating it.
var finishJson =
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","deck_no":1,"is_win":1,"evolve_count":2,"total_turn":5,"enemy_class_id":3,"difficulty":1,"deck_format":0,"class_id":1,"recovery_data":"{\"opaque\":\"blob\"}"}""";
"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","deck_no":1,"is_win":1,"evolve_count":2,"total_turn":5,"enemy_class_id":3,"difficulty":1,"deck_format":1,"class_id":1,"recovery_data":"{\"opaque\":\"blob\"}"}""";
var response = await client.PostAsync("/practice/finish",
new StringContent(finishJson, Encoding.UTF8, "application/json"));