fix(test): delete user_game_playtime_day rows in seed
Build, Test & Push Core Service / quality-check (push) Successful in 1m45s
Build, Test & Push Core Service / docker (push) Successful in 1m38s

RewardControllerTest leaves user_game_playtime_day rows for user 1,
affecting paceWeeks calculation. Delete them in seed() to ensure
clean test isolation.
This commit is contained in:
lobo committed 2026-10-09 19:32:35 +02:00
1 parent b24fd91e88
commit 696e06e7fe
1 file changed
+5
@@ -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())));