test(free-battle): 3001 when viewer has no deck for format
This commit is contained in:
@@ -93,4 +93,23 @@ public class FreeBattleControllerTests
|
|||||||
Assert.That(j3.GetProperty("matching_state").GetInt32(), Is.EqualTo(3007), "Owner = 3007.");
|
Assert.That(j3.GetProperty("matching_state").GetInt32(), Is.EqualTo(3007), "Owner = 3007.");
|
||||||
Assert.That(j3.GetProperty("battle_id").GetString(), Is.EqualTo(j2.GetProperty("battle_id").GetString()));
|
Assert.That(j3.GetProperty("battle_id").GetString(), Is.EqualTo(j2.GetProperty("battle_id").GetString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task DoMatching_returns_3001_when_viewer_has_no_deck_for_format_and_slot()
|
||||||
|
{
|
||||||
|
await using var factory = new SVSimTestFactory();
|
||||||
|
var viewerId = await factory.SeedViewerAsync();
|
||||||
|
await factory.SeedGlobalsAsync();
|
||||||
|
// Note: NO SeedDeckAsync. BuildForRankBattleAsync will throw InvalidOperationException.
|
||||||
|
var client = factory.CreateAuthenticatedClient(viewerId);
|
||||||
|
|
||||||
|
var resp = await client.PostAsJsonAsync("/unlimited_free_battle/do_matching", DoMatchingBody);
|
||||||
|
|
||||||
|
Assert.That(resp.IsSuccessStatusCode, Is.True);
|
||||||
|
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
|
||||||
|
var data = doc.RootElement;
|
||||||
|
Assert.That(data.GetProperty("matching_state").GetInt32(), Is.EqualTo(3001),
|
||||||
|
"Missing deck → RC_BATTLE_MATCHING_ILLEGAL.");
|
||||||
|
Assert.That(data.GetProperty("node_server_url").GetString(), Is.EqualTo(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user