feat(mypage): /mypage/finish_battle (returns check=0 — no in-flight state yet)

This commit is contained in:
gamer147
2026-06-12 23:08:42 -04:00
parent b4a87792dc
commit 43e4c06a2c
4 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System.Net;
using System.Text;
using System.Text.Json;
using NUnit.Framework;
using SVSim.UnitTests.Infrastructure;
namespace SVSim.UnitTests.Controllers;
public class MyPageControllerFinishBattleTests
{
[Test]
public async Task FinishBattle_returns_check_zero()
{
using var factory = new SVSimTestFactory();
long viewerId = await factory.SeedViewerAsync(tutorialState: 0);
using var client = factory.CreateAuthenticatedClient(viewerId);
var requestJson = """{"SDTRB":0,"viewer_id":"0","steam_id":0,"steam_session_ticket":""}""";
var response = await client.PostAsync("/mypage/finish_battle",
new StringContent(requestJson, Encoding.UTF8, "application/json"));
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
var body = await response.Content.ReadAsStringAsync();
using var doc = JsonDocument.Parse(body);
Assert.That(doc.RootElement.GetProperty("check_unfinished_battle").GetInt32(), Is.EqualTo(0));
}
}