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);