package model

import "testing"

func TestFilterQuestTemplatesByNPCType(t *testing.T) {
	qs := []Quest{
		{ID: 1, Type: "kill_count"},
		{ID: 2, Type: "visit_town"},
		{ID: 3, Type: "collect_item"},
	}
	b := FilterQuestTemplatesByNPCType(qs, NPCTypeBounty)
	if len(b) != 2 || b[0].ID != 1 || b[1].ID != 3 {
		t.Fatalf("bounty filter: got %+v", b)
	}
	e := FilterQuestTemplatesByNPCType(qs, NPCTypeElder)
	if len(e) != 2 || e[0].ID != 2 || e[1].ID != 3 {
		t.Fatalf("elder filter: got %+v", e)
	}
	if len(FilterQuestTemplatesByNPCType(qs, NPCTypeQuestGiver)) != 3 {
		t.Fatal("legacy quest_giver should not filter")
	}
}

func TestGearVendorSlots(t *testing.T) {
	if len(GearVendorSlots(NPCTypeWeapon)) != 1 || GearVendorSlots(NPCTypeWeapon)[0] != SlotMainHand {
		t.Fatal("weapon vendor slots")
	}
	if !IsGearVendorType(NPCTypeJeweler) || IsGearVendorType(NPCTypeHealer) {
		t.Fatal("IsGearVendorType")
	}
}
