Fixed some small bugs after merge

This commit is contained in:
2026-06-14 11:30:58 +02:00
parent 0894d65ec5
commit 4e5bdc4ee2
21 changed files with 1460 additions and 186 deletions
+10 -5
View File
@@ -73,6 +73,11 @@ func TestPartialMigrationThenSyncThenComplete(t *testing.T) {
require.Equal(t, http.StatusOK, rec.Code)
// Wait for sync to complete
if !waitForSyncCompletion(t, e, 60) {
t.Error("Sync did not complete within timeout")
}
// Verify data via statistics endpoint
req = httptest.NewRequest(http.MethodGet, "/api/v1/statistics/summary", nil)
req.Header.Set("Authorization", "Bearer "+token)
@@ -85,9 +90,9 @@ func TestPartialMigrationThenSyncThenComplete(t *testing.T) {
err := json.Unmarshal(rec.Body.Bytes(), &summary)
require.NoError(t, err)
// We inserted 5 soundtracks, so total should be at least 5
// (there might be existing data)
require.GreaterOrEqual(t, summary.TotalGames, int64(5))
// After sync with /sync/new, only soundtracks matching filesystem remain
// testMusic has 3 games
require.Equal(t, int64(3), summary.TotalGames)
}
// insertTestData inserts 5 test soundtracks with songs into the database
@@ -115,8 +120,8 @@ func insertTestData(t *testing.T) {
for _, st := range soundtracks {
_, err := queries.InsertSoundtrack(ctx, repository.InsertSoundtrackParams{
SoundtrackName: st.name,
Path: st.path,
Hash: "test-hash-" + st.name,
Path: st.path,
Hash: "test-hash-" + st.name,
})
require.NoError(t, err, "Failed to insert soundtrack: %s", st.name)
}