From 4dc9f76f7909bbd4449084f9dd50518d7a27dd54 Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sat, 25 Apr 2026 22:47:44 -0400 Subject: [PATCH] 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. --- ...otbarLoadoutPersistenceIntegrationTests.cs | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/server/NeonSprawl.Server.Tests/Game/AbilityInput/HotbarLoadoutPersistenceIntegrationTests.cs b/server/NeonSprawl.Server.Tests/Game/AbilityInput/HotbarLoadoutPersistenceIntegrationTests.cs index 2811722..0ce6f24 100644 --- a/server/NeonSprawl.Server.Tests/Game/AbilityInput/HotbarLoadoutPersistenceIntegrationTests.cs +++ b/server/NeonSprawl.Server.Tests/Game/AbilityInput/HotbarLoadoutPersistenceIntegrationTests.cs @@ -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( "/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);