From 696e06e7fedc11c53c873bb6ce1bc290ca0ec928 Mon Sep 17 00:00:00 2001 From: lobo Date: Fri, 9 Oct 2026 19:32:35 +0200 Subject: [PATCH] fix(test): delete user_game_playtime_day rows in seed RewardControllerTest leaves user_game_playtime_day rows for user 1, affecting paceWeeks calculation. Delete them in seed() to ensure clean test isolation. --- .../modules/library/api/LibraryControllerStatsTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/core_service/modules/library/api/LibraryControllerStatsTest.java b/src/test/java/core_service/modules/library/api/LibraryControllerStatsTest.java index d0ebff5..560622a 100644 --- a/src/test/java/core_service/modules/library/api/LibraryControllerStatsTest.java +++ b/src/test/java/core_service/modules/library/api/LibraryControllerStatsTest.java @@ -15,6 +15,7 @@ import org.springframework.dao.DataIntegrityViolationException; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.http.converter.HttpMessageNotWritableException; import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.test.web.servlet.MockMvc; @@ -55,9 +56,13 @@ class LibraryControllerStatsTest extends AbstractMockedLibraryServicesTest { @Autowired private GameTimeToBeatRepository gameTimeToBeatRepository; + @Autowired + private JdbcTemplate jdbc; + @BeforeEach void seed() { userGameRepository.deleteAll(); + jdbc.update("delete from user_game_playtime_day where user_id = ?", USER_ID); steamGameRepository.saveAll(List.of( new SteamGame(220L, "Half-Life 2", null, Instant.now()), new SteamGame(620L, "Portal 2", null, Instant.now())));