feat(rewards): add completed, background and banner effect items
Build, Test & Push Core Service / quality-check (push) Successful in 1m4s
Build, Test & Push Core Service / docker (push) Successful in 1m31s

This commit is contained in:
lobo committed 2026-10-01 15:09:25 +02:00
1 parent 349fa40272
commit a12ed20705
7 files changed
+42 -8

No files matched your search

@@ -1,6 +1,7 @@
package core_service.modules.rewards.api;
import core_service.configuration.security.ClientHeaderFilter;
import core_service.modules.rewards.domain.ShopItem;
import core_service.modules.rewards.service.RewardService;
import core_service.shared.security.Role;
import core_service.shared.test.AbstractIntegrationTest;
@@ -81,7 +82,7 @@ class RewardControllerTest extends AbstractIntegrationTest {
.andExpect(jsonPath("$.balance").value(30))
.andExpect(jsonPath("$.history[0].kind").value("FINISHED"))
.andExpect(jsonPath("$.history[0].gameName").value("Game " + GAME))
.andExpect(jsonPath("$.catalog.length()").value(8))
.andExpect(jsonPath("$.catalog.length()").value(ShopItem.values().length))
.andExpect(jsonPath("$.owned").isEmpty());
setStatus(GAME, "BACKLOG");
@@ -212,7 +213,7 @@ class RewardControllerTest extends AbstractIntegrationTest {
@Test
void admin_OwnsEveryItem_NeverBuysAndFallsBackToDefaultAsAUser() throws Exception {
mockMvc.perform(asAdmin(get("/api/rewards/wallet")))
.andExpect(jsonPath("$.owned.length()").value(8));
.andExpect(jsonPath("$.owned.length()").value(ShopItem.values().length));
mockMvc.perform(asAdmin(post("/api/rewards/purchases")).header(ClientHeaderFilter.CLIENT_HEADER, "test")
.contentType(MediaType.APPLICATION_JSON).content("{\"item\":\"FRAME_GOLD\"}"))
.andExpect(status().isConflict()).andExpect(jsonPath("$.code").value("ALREADY_OWNED"));
@@ -25,9 +25,10 @@ class LooksTest extends AbstractUnitTest {
@Test
void wearable_DropsLooksThatAreNotOwnedOrNotInTheCatalog() {
Map<LookSlot, String> equipped = Map.of(LookSlot.AVATAR_BORDER, "BORDER_GOLD", LookSlot.BADGE, "BADGE_PILE_SLAYER",
LookSlot.ACCENT, "ACCENT_NEON_PINK");
LookSlot.ACCENT, "ACCENT_NEON_PINK", LookSlot.BANNER_BACKGROUND, "BN_GRID");
assertThat(Looks.wearable(equipped, Set.of("BORDER_GOLD", "ACCENT_NEON_PINK")))
.containsOnly(Map.entry(LookSlot.AVATAR_BORDER, "BORDER_GOLD"));
assertThat(Looks.wearable(equipped, Set.of("BORDER_GOLD", "ACCENT_NEON_PINK", "BN_GRID")))
.containsOnly(Map.entry(LookSlot.AVATAR_BORDER, "BORDER_GOLD"),
Map.entry(LookSlot.BANNER_BACKGROUND, "BN_GRID"));
}
}
@@ -99,4 +99,11 @@ class RewardLedgerRepositoryTest extends AbstractPersistenceTest {
assertThat(repository.equipped(USER)).containsOnlyKeys(LookSlot.ACCENT);
}
@Test
void equip_TheLongestSlotNameFits() {
repository.equip(USER, LookSlot.BANNER_BACKGROUND, "BN_GRID");
assertThat(repository.equipped(USER)).containsOnly(Map.entry(LookSlot.BANNER_BACKGROUND, "BN_GRID"));
}
}