test(free-battle): force_finish no-op returns empty object
This commit is contained in:
@@ -151,4 +151,22 @@ public class FreeBattleControllerTests
|
||||
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
|
||||
Assert.That(doc.RootElement.GetProperty("battle_result").GetInt32(), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ForceFinish_returns_200_with_empty_object()
|
||||
{
|
||||
await using var factory = new SVSimTestFactory();
|
||||
var viewerId = await factory.SeedViewerAsync();
|
||||
var client = factory.CreateAuthenticatedClient(viewerId);
|
||||
|
||||
var resp = await client.PostAsJsonAsync("/free_battle/force_finish", EmptyAuthedBody);
|
||||
|
||||
Assert.That(resp.IsSuccessStatusCode, Is.True);
|
||||
var raw = await resp.Content.ReadAsStringAsync();
|
||||
using var doc = JsonDocument.Parse(raw);
|
||||
Assert.That(doc.RootElement.ValueKind, Is.EqualTo(JsonValueKind.Object));
|
||||
// Empty object: no enumerable properties.
|
||||
Assert.That(doc.RootElement.EnumerateObject().MoveNext(), Is.False,
|
||||
"Body should be {} — defensive no-op for dead URL.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user