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.
33 lines
861 B
Go
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")
|
|
}
|
|
}
|