mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-27 01:53:19 +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:
99
server/channelserver/handlers_guild_mission_test.go
Normal file
99
server/channelserver/handlers_guild_mission_test.go
Normal file
@@ -0,0 +1,99 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
)
|
||||
|
||||
// --- Guild mission handler tests ---
|
||||
|
||||
func TestHandleMsgMhfAddGuildMissionCount(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
handleMsgMhfAddGuildMissionCount(session, &mhfpacket.MsgMhfAddGuildMissionCount{
|
||||
AckHandle: 1,
|
||||
})
|
||||
|
||||
select {
|
||||
case p := <-session.sendPackets:
|
||||
if len(p.data) == 0 {
|
||||
t.Error("response should have data")
|
||||
}
|
||||
default:
|
||||
t.Error("no response queued")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfSetGuildMissionTarget(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
handleMsgMhfSetGuildMissionTarget(session, &mhfpacket.MsgMhfSetGuildMissionTarget{
|
||||
AckHandle: 1,
|
||||
})
|
||||
|
||||
select {
|
||||
case p := <-session.sendPackets:
|
||||
if len(p.data) == 0 {
|
||||
t.Error("response should have data")
|
||||
}
|
||||
default:
|
||||
t.Error("no response queued")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfCancelGuildMissionTarget(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
handleMsgMhfCancelGuildMissionTarget(session, &mhfpacket.MsgMhfCancelGuildMissionTarget{
|
||||
AckHandle: 1,
|
||||
})
|
||||
|
||||
select {
|
||||
case p := <-session.sendPackets:
|
||||
if len(p.data) == 0 {
|
||||
t.Error("response should have data")
|
||||
}
|
||||
default:
|
||||
t.Error("no response queued")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetGuildMissionRecord(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
handleMsgMhfGetGuildMissionRecord(session, &mhfpacket.MsgMhfGetGuildMissionRecord{
|
||||
AckHandle: 1,
|
||||
})
|
||||
|
||||
select {
|
||||
case p := <-session.sendPackets:
|
||||
if len(p.data) == 0 {
|
||||
t.Error("response should have data")
|
||||
}
|
||||
default:
|
||||
t.Error("no response queued")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfGetGuildMissionList(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
handleMsgMhfGetGuildMissionList(session, &mhfpacket.MsgMhfGetGuildMissionList{
|
||||
AckHandle: 1,
|
||||
})
|
||||
|
||||
select {
|
||||
case p := <-session.sendPackets:
|
||||
if len(p.data) == 0 {
|
||||
t.Error("response should have data")
|
||||
}
|
||||
default:
|
||||
t.Error("no response queued")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user