Public Access
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.
This commit is contained in:
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())));
|
||||
|
||||
Reference in new issue
Block a user