mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 09:33:02 +01:00
fix(channelserver): resolve all golangci-lint issues and add handler tests
Fix errcheck violations across 11 repo files by wrapping deferred rows.Close() and tx.Rollback() calls to discard the error return. Fix unchecked Scan/Exec calls in guild store tests. Fix staticcheck SA9003 empty branch in test helpers. Add 6 mock-based unit tests for GetCharacterSaveData covering nil savedata, sql.ErrNoRows, DB errors, compressed round-trip, new-character skip, and config mode/pointer propagation.
This commit is contained in:
@@ -118,6 +118,13 @@ type mockCharacterRepo struct {
|
||||
adjustErr error
|
||||
readErr error
|
||||
saveErr error
|
||||
|
||||
// LoadSaveData mock fields
|
||||
loadSaveDataID uint32
|
||||
loadSaveDataData []byte
|
||||
loadSaveDataNew bool
|
||||
loadSaveDataName string
|
||||
loadSaveDataErr error
|
||||
}
|
||||
|
||||
func newMockCharacterRepo() *mockCharacterRepo {
|
||||
@@ -194,7 +201,9 @@ func (m *mockCharacterRepo) UpdateGCPAndPact(_ uint32, _ uint32, _ uint32) error
|
||||
func (m *mockCharacterRepo) FindByRastaID(_ int) (uint32, string, error) { return 0, "", nil }
|
||||
func (m *mockCharacterRepo) SaveCharacterData(_ uint32, _ []byte, _, _ uint16, _ bool, _ uint8, _ uint16) error { return nil }
|
||||
func (m *mockCharacterRepo) SaveHouseData(_ uint32, _ []byte, _, _, _, _, _ []byte) error { return nil }
|
||||
func (m *mockCharacterRepo) LoadSaveData(_ uint32) (uint32, []byte, bool, string, error) { return 0, nil, false, "", nil }
|
||||
func (m *mockCharacterRepo) LoadSaveData(_ uint32) (uint32, []byte, bool, string, error) {
|
||||
return m.loadSaveDataID, m.loadSaveDataData, m.loadSaveDataNew, m.loadSaveDataName, m.loadSaveDataErr
|
||||
}
|
||||
|
||||
// --- mockGoocooRepo ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user