Files
bd2/go/internal/server/gamedata/event_battle_challenge_test.go
T
Flechazo d8771caef2 feat(all): add hunting and events, commerce and rewards, binary calendars, GameData caching and login diagnostics
Implement hunting AP and progress, event tasks, exchanges, games, stories and actions; connect battle and reward handling.

Add CashShop plugin and installation, server purchases and entitlements, recharge rules and plugin version metadata.

Distribute binary calendars independently; cache GameData in memory and fix single-connection query deadlocks.

Improve automatic login and recovery diagnostics; document configuration and release flows.
2026-10-05 11:50:31 +08:00

33 lines
861 B
Go

package gamedata
import (
"bd2server/internal/server/wire"
"os"
"testing"
)
func TestEventBattleChallengeInstalledSmoke(t *testing.T) {
root, version := os.Getenv("BD2_GAMEDATA_ROOT"), os.Getenv("BD2_GAMEDATA_VERSION")
if root == "" || version == "" {
t.Skip("installed design env required")
}
d, e := LoadEventBattleChallenges(root, version)
if e != nil {
t.Fatal(e)
}
if len(d) == 0 {
t.Fatal("empty challenges")
}
}
func TestChallengeIndexesPackedAndDuplicate(t *testing.T) {
definitions := []EventBattleChallenge{{Type: 8}, {Type: 2, Value1: 8}}
req := wire.AppendBytes(nil, 5, []byte{0, 1})
out, e := VerifySubmittedChallenges(req, definitions)
if e != nil || len(out) != 2 {
t.Fatal(out, e)
}
if _, e = VerifySubmittedChallenges(wire.AppendBytes(nil, 5, []byte{0, 0}), definitions); e == nil {
t.Fatal("duplicate index")
}
}