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)
	}
}
