fix(channelserver): correct 3 test bugs causing 10 deterministic failures

- Use users.frontier_points instead of characters.frontier_points
  (column moved in 9.2 schema migration) across savedata and session
  lifecycle tests
- Use BYTEA column (otomoairou) instead of INTEGER column
  (kouryou_point) in repo_character Load/SaveColumn tests
- Build blocked CSV from actual auto-incremented character IDs instead
  of hardcoded IDs in ListMember integration test
- Fix nil charRepo panic in CompleteSaveLoadCycle by using SetTestDB()
This commit is contained in:
Houmgaor
2026-02-20 23:55:02 +01:00
parent f2f31cdfbb
commit eb66de8ef9
4 changed files with 35 additions and 37 deletions

View File

@@ -160,22 +160,18 @@ func TestHandleMsgMhfListMember_Integration(t *testing.T) {
tests := []struct {
name string
blockedCSV string
wantBlockCount int
}{
{
name: "no_blocked_users",
blockedCSV: "",
wantBlockCount: 0,
},
{
name: "single_blocked_user",
blockedCSV: "2",
wantBlockCount: 1,
},
{
name: "multiple_blocked_users",
blockedCSV: "2,3,4",
wantBlockCount: 3,
},
}
@@ -187,17 +183,19 @@ func TestHandleMsgMhfListMember_Integration(t *testing.T) {
charName := fmt.Sprintf("Char%d", i)
charID := CreateTestCharacter(t, db, userID, charName)
// Create blocked characters
if tt.blockedCSV != "" {
// Create the blocked users
for i := 2; i <= 4; i++ {
blockedUserID := CreateTestUser(t, db, "blocked_user_"+tt.name+"_"+string(rune(i)))
CreateTestCharacter(t, db, blockedUserID, "BlockedChar_"+string(rune(i)))
// Create blocked characters and build CSV from their actual IDs
blockedCSV := ""
for j := 0; j < tt.wantBlockCount; j++ {
blockedUserID := CreateTestUser(t, db, fmt.Sprintf("blk_%s_%d", tt.name, j))
blockedCharID := CreateTestCharacter(t, db, blockedUserID, fmt.Sprintf("Blk%d_%d", i, j))
if blockedCSV != "" {
blockedCSV += ","
}
blockedCSV += fmt.Sprintf("%d", blockedCharID)
}
// Set blocked list
_, err := db.Exec("UPDATE characters SET blocked = $1 WHERE id = $2", tt.blockedCSV, charID)
_, err := db.Exec("UPDATE characters SET blocked = $1 WHERE id = $2", blockedCSV, charID)
if err != nil {
t.Fatalf("Failed to update blocked list: %v", err)
}