mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-24 16:43:37 +01:00
Add tests for: - Discord handlers (getPlayerSlice, getCharacterList) - House handlers (boxToBytes, HouseData, Title structs) - Mail struct tests - Mercenary handlers (Partner, HunterNavi structs) - Shop/Gacha handlers (writeShopItems, ShopItem, Gacha structs) - Additional handler coverage for guild, tower, and simple handlers - Stage handler tests for binary operations and enumeration - Channel server tests for BroadcastMHF and session management
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package channelserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"erupe-ce/network/mhfpacket"
|
|
)
|
|
|
|
func TestHandleMsgMhfGetRengokuRankingRank(t *testing.T) {
|
|
server := createMockServer()
|
|
session := createMockSession(1, server)
|
|
|
|
pkt := &mhfpacket.MsgMhfGetRengokuRankingRank{
|
|
AckHandle: 12345,
|
|
}
|
|
|
|
handleMsgMhfGetRengokuRankingRank(session, pkt)
|
|
|
|
// Verify response packet was queued
|
|
select {
|
|
case p := <-session.sendPackets:
|
|
if len(p.data) == 0 {
|
|
t.Error("Response packet should have data")
|
|
}
|
|
default:
|
|
t.Error("No response packet queued")
|
|
}
|
|
}
|
|
|
|
func TestRengokuScoreStruct(t *testing.T) {
|
|
score := RengokuScore{
|
|
Name: "TestPlayer",
|
|
Score: 12345,
|
|
}
|
|
|
|
if score.Name != "TestPlayer" {
|
|
t.Errorf("Name = %s, want TestPlayer", score.Name)
|
|
}
|
|
if score.Score != 12345 {
|
|
t.Errorf("Score = %d, want 12345", score.Score)
|
|
}
|
|
}
|
|
|
|
func TestRengokuScoreStruct_DefaultValues(t *testing.T) {
|
|
score := RengokuScore{}
|
|
|
|
if score.Name != "" {
|
|
t.Errorf("Default Name should be empty, got %s", score.Name)
|
|
}
|
|
if score.Score != 0 {
|
|
t.Errorf("Default Score should be 0, got %d", score.Score)
|
|
}
|
|
}
|