Things were working, suddenly regressed
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user