Files
bd2/go/internal/server/gamedata/cooking_recipes_test.go
T
Flechazo 5b5a219dc2 feat(server): add special loot and data-driven gameplay rules
Generate equipment loot atomically, grant random boxes and prevent repeat claims.
Read gacha pools, pity, products, tickets, missions, presets, chapter rewards
and inventory costs from GameData; extend both collaboration UR ticket pools.
Sync owned recipes, configure startup state and calendars in versioned seeds,
and validate unlock tickets and revival talents.
2026-10-04 19:15:59 +08:00

28 lines
744 B
Go

package gamedata
import (
"database/sql"
"testing"
)
func TestCookingRecipesReadCatalogIdentities(t *testing.T) {
db, err := sql.Open("sqlite", ":memory:")
if err != nil {
t.Fatal(err)
}
defer db.Close()
if _, err := db.Exec("CREATE TABLE CookingTable(id INTEGER); INSERT INTO CookingTable VALUES(503),(707)"); err != nil {
t.Fatal(err)
}
design, err := loadCookingRecipeDesign(db)
if err != nil || len(design.IDs) != 2 || !design.IDs[503] || !design.IDs[707] || design.IDs[101] {
t.Fatalf("design=%+v err=%v", design, err)
}
if _, err := db.Exec("INSERT INTO CookingTable VALUES(0)"); err != nil {
t.Fatal(err)
}
if _, err := loadCookingRecipeDesign(db); err == nil {
t.Fatal("invalid recipe identity accepted")
}
}