NEO-29: align hotbar persistence test to AAA style

Refactor the Postgres hotbar persistence integration test to explicit Arrange/Act/Assert structure so it matches the team testing style guide.
pull/54/head
VinPropane 2026-04-25 22:47:44 -04:00
parent d25d7d0211
commit 4dc9f76f79
1 changed files with 25 additions and 18 deletions

View File

@ -15,36 +15,43 @@ public sealed class HotbarLoadoutPersistenceIntegrationTests(PostgresIntegration
[RequirePostgresFact]
public async Task PostThenGetAcrossNewFactory_ShouldPersistHotbarBindings()
{
// Arrange
await ResetHotbarTableAsync();
var update = new HotbarLoadoutUpdateRequest
{
SchemaVersion = HotbarLoadoutUpdateRequest.CurrentSchemaVersion,
Slots =
[
new HotbarSlotBindingJson
{
SlotIndex = 1,
AbilityId = PrototypeAbilityRegistry.PrototypePulse,
},
new HotbarSlotBindingJson
{
SlotIndex = 4,
AbilityId = PrototypeAbilityRegistry.PrototypeGuard,
},
],
};
HttpStatusCode postStatus;
// Act
using (var firstClient = Factory.CreateClient())
{
var post = await firstClient.PostAsJsonAsync(
"/game/players/dev-local-1/hotbar-loadout",
new HotbarLoadoutUpdateRequest
{
SchemaVersion = HotbarLoadoutUpdateRequest.CurrentSchemaVersion,
Slots =
[
new HotbarSlotBindingJson
{
SlotIndex = 1,
AbilityId = PrototypeAbilityRegistry.PrototypePulse,
},
new HotbarSlotBindingJson
{
SlotIndex = 4,
AbilityId = PrototypeAbilityRegistry.PrototypeGuard,
},
],
});
Assert.Equal(HttpStatusCode.OK, post.StatusCode);
update);
postStatus = post.StatusCode;
}
await using var secondFactory = new PostgresWebApplicationFactory();
using var secondClient = secondFactory.CreateClient();
var loadout = await secondClient.GetFromJsonAsync<HotbarLoadoutResponse>(
"/game/players/dev-local-1/hotbar-loadout");
// Assert
Assert.Equal(HttpStatusCode.OK, postStatus);
Assert.NotNull(loadout);
Assert.Equal(PrototypeAbilityRegistry.PrototypePulse, loadout!.Slots[1].AbilityId);
Assert.Equal(PrototypeAbilityRegistry.PrototypeGuard, loadout.Slots[4].AbilityId);