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.

32 lines
908 B
Go

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