test: add coverage tests to reach 65% total coverage

Add 16 test files across 4 packages covering previously untested
handler paths: guild board operations, house/warehouse management,
tower/tenrouirai progress, diva schedule, festa info, cafe duration,
API error paths, sign server responses, and byteframe boundaries.
This commit is contained in:
Houmgaor
2026-02-26 23:17:12 +01:00
parent cdc4cd9ba3
commit a68d76c55f
16 changed files with 3077 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
package channelserver
import (
cfg "erupe-ce/config"
"erupe-ce/network/mhfpacket"
"testing"
"time"
)
func TestHandleMsgMhfInfoFesta_OverrideZero(t *testing.T) {
srv := createMockServer()
srv.festaRepo = &mockFestaRepo{}
srv.erupeConfig.DebugOptions.FestaOverride = 0
s := createMockSession(100, srv)
pkt := &mhfpacket.MsgMhfInfoFesta{AckHandle: 1}
handleMsgMhfInfoFesta(s, pkt)
<-s.sendPackets
}
func TestHandleMsgMhfInfoFesta_WithActiveEvent(t *testing.T) {
srv := createMockServer()
srv.erupeConfig.DebugOptions.FestaOverride = 1
srv.erupeConfig.RealClientMode = cfg.ZZ
srv.erupeConfig.GameplayOptions.MaximumFP = 50000
srv.festaRepo = &mockFestaRepo{
events: []FestaEvent{{ID: 1, StartTime: uint32(time.Now().Add(-24 * time.Hour).Unix())}},
trials: []FestaTrial{
{ID: 1, Objective: 1, GoalID: 100, TimesReq: 5, Locale: 0, Reward: 10, Monopoly: "blue"},
},
}
ensureFestaService(srv)
s := createMockSession(100, srv)
pkt := &mhfpacket.MsgMhfInfoFesta{AckHandle: 1}
handleMsgMhfInfoFesta(s, pkt)
<-s.sendPackets
}
func TestHandleMsgMhfInfoFesta_FutureTimestamp(t *testing.T) {
srv := createMockServer()
srv.erupeConfig.DebugOptions.FestaOverride = -1
srv.festaRepo = &mockFestaRepo{
events: []FestaEvent{{ID: 1, StartTime: uint32(time.Now().Add(72 * time.Hour).Unix())}},
}
ensureFestaService(srv)
s := createMockSession(100, srv)
pkt := &mhfpacket.MsgMhfInfoFesta{AckHandle: 1}
handleMsgMhfInfoFesta(s, pkt)
<-s.sendPackets
}