mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
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:
@@ -4,6 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"time"
|
||||
cfg "erupe-ce/config"
|
||||
)
|
||||
|
||||
func TestHandleMsgMhfGetUdInfo(t *testing.T) {
|
||||
@@ -341,3 +343,86 @@ func TestGenerateDivaTimestamps_NonDebug_WithValidStart(t *testing.T) {
|
||||
t.Error("Third timestamp should be second + 3900")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_DivaOverrideZero_ZZ(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = 0
|
||||
srv.erupeConfig.RealClientMode = cfg.ZZ
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_DivaOverrideZero_OlderClient(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = 0
|
||||
srv.erupeConfig.RealClientMode = cfg.G10
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_DivaOverride1(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = 1
|
||||
srv.erupeConfig.RealClientMode = cfg.ZZ
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_DivaOverride2(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = 2
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_DivaOverride3(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = 3
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_WithExistingEvent(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{
|
||||
events: []DivaEvent{{ID: 1, StartTime: uint32(time.Now().Unix())}},
|
||||
}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = -1
|
||||
srv.erupeConfig.RealClientMode = cfg.ZZ
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetUdSchedule_NoEvents(t *testing.T) {
|
||||
srv := createMockServer()
|
||||
srv.divaRepo = &mockDivaRepo{}
|
||||
srv.erupeConfig.DebugOptions.DivaOverride = -1
|
||||
s := createMockSession(100, srv)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfGetUdSchedule{AckHandle: 1}
|
||||
handleMsgMhfGetUdSchedule(s, pkt)
|
||||
<-s.sendPackets
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user