You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
701 B
Go

package main
import (
"path/filepath"
"testing"
"github.com/denisovdennis/autohero/internal/model"
)
func TestApplyGearOverlayJSON(t *testing.T) {
base := []model.GearFamily{
{Slot: model.SlotChest, Name: "Chainmail", BasePrimary: 7, Subtype: "medium"},
{Slot: model.SlotMainHand, Name: "Iron Sword", BasePrimary: 5, Subtype: "sword"},
}
path := filepath.Join("testdata", "gear_overlay_sample.json")
out, err := applyGearOverlayJSON(path, base)
if err != nil {
t.Fatal(err)
}
if out[0].BasePrimary != 4 {
t.Fatalf("Chainmail basePrimary = %d, want 4", out[0].BasePrimary)
}
if out[1].BasePrimary != 7 {
t.Fatalf("Iron Sword basePrimary = %d, want 7", out[1].BasePrimary)
}
}