refactor(channelserver): consolidate tests into matching source test files

Move ~300 test functions from 21 catch-all files (handlers_core_test.go,
handlers_coverage*_test.go, *_coverage_test.go) into the *_test.go file
matching each handler's source file. This makes tests discoverable by
convention: tests for handlers_guild.go live in handlers_guild_test.go.

New files: handlers_guild_mission_test.go, sys_time_test.go.
No test logic changed — pure file reorganization.
This commit is contained in:
Houmgaor
2026-02-26 23:41:44 +01:00
parent a68d76c55f
commit d0837e779c
53 changed files with 5922 additions and 6118 deletions

View File

@@ -651,3 +651,57 @@ func TestConcurrentSaveData_Integration(t *testing.T) {
}
}
}
// =============================================================================
// Tests consolidated from handlers_coverage4_test.go
// =============================================================================
func TestGrpToGR(t *testing.T) {
tests := []struct {
name string
input int
expected uint16
}{
{"zero", 0, 1},
{"low_value", 500, 2},
{"first_bracket", 1000, 2},
{"mid_bracket", 208750, 51},
{"second_bracket", 300000, 62},
{"high_value", 593400, 100},
{"third_bracket", 700000, 113},
{"very_high", 993400, 150},
{"above_993400", 1000000, 150},
{"fourth_bracket", 1400900, 200},
{"max_bracket", 11345900, 900},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := grpToGR(tt.input)
if got != tt.expected {
t.Errorf("grpToGR(%d) = %d, want %d", tt.input, got, tt.expected)
}
})
}
}
func TestDumpSaveData_Disabled(t *testing.T) {
server := createMockServer()
server.erupeConfig.SaveDumps.Enabled = false
session := createMockSession(1, server)
// Should return immediately without error
dumpSaveData(session, []byte{0x01, 0x02, 0x03}, "test")
}
func TestHandleMsgSysAuthData(t *testing.T) {
server := createMockServer()
session := createMockSession(1, server)
defer func() {
if r := recover(); r != nil {
t.Errorf("handleMsgSysAuthData panicked: %v", r)
}
}()
handleMsgSysAuthData(session, nil)
}