-- Data integrity tests for BISLists.lua — run offline, no WoW client needed. local _, ns = ... local BIS = ns.Data.BISLists local VALID_SLOTS = { Head = true, Neck = true, Shoulder = true, Back = true, Chest = true, Wrist = true, Hands = true, Waist = true, Legs = true, Feet = true, Finger0 = true, Finger1 = true, Trinket0 = true, Trinket1 = true, MainHand = true, SecondaryHand = true, Ranged = true, } local function validate_entry(slot, entry) expect(VALID_SLOTS[slot]).toBeTruthy() expect(type(entry.itemID)).toEqual("number") expect(entry.itemID > 0).toBeTruthy() expect(type(entry.name)).toEqual("string") expect(#entry.name > 0).toBeTruthy() expect(type(entry.source)).toEqual("string") expect(#entry.source > 0).toBeTruthy() if entry.enchant then expect(type(entry.enchant.id)).toEqual("number") expect(type(entry.enchant.name)).toEqual("string") expect(#entry.enchant.name > 0).toBeTruthy() end end describe("BIS data registry", function() local classes = BIS:GetAvailableClasses() it("covers all 9 classes", function() expect(#classes).toEqual(9) end) for _, class in ipairs(classes) do local specs = BIS:GetAvailableSpecs(class) table.sort(specs) it(class .. " has all 3 specs", function() expect(#specs).toEqual(3) end) for _, spec in ipairs(specs) do it(class .. "/" .. spec .. " lists are well-formed", function() local phases = BIS:GetAvailablePhases(class, spec) expect(#phases > 0).toBeTruthy() for _, phase in ipairs(phases) do local list = BIS:GetBISList(class, spec, phase) expect(list).toBeTruthy() local count = 0 for slot, entry in pairs(list) do count = count + 1 validate_entry(slot, entry) end expect(count >= 8).toBeTruthy() end end) end end end) describe("phase ordering and resolution", function() it("returns phases in canonical order", function() local phases = BIS:GetAvailablePhases("PRIEST", "Shadow") expect(phases[1]).toEqual("T4") expect(phases[2]).toEqual("T5") expect(phases[3]).toEqual("T6") expect(phases[4]).toEqual("ZA") end) it("reports the latest phase for every spec", function() for _, class in ipairs(BIS:GetAvailableClasses()) do for _, spec in ipairs(BIS:GetAvailableSpecs(class)) do expect(BIS:GetLatestPhase(class, spec)).toEqual("ZA") end end end) it("keeps the saved phase when it exists", function() expect(BIS:ResolvePhase("PRIEST", "Shadow", "ZA")).toEqual("ZA") expect(BIS:ResolvePhase("PRIEST", "Shadow", "T6")).toEqual("T6") expect(BIS:ResolvePhase("PRIEST", "Shadow", "T5")).toEqual("T5") end) it("falls back to the first available phase", function() expect(BIS:ResolvePhase("PALADIN", "Protection", "T5")).toEqual("T4") expect(BIS:ResolvePhase("DRUID", "Feral Combat", "T5")).toEqual("T4") expect(BIS:ResolvePhase("DRUID", "Balance", "T6")).toEqual("T6") end) it("returns preferred phase for unknown class", function() expect(BIS:ResolvePhase("DEATHKNIGHT", "Frost", "T5")).toEqual("T5") end) it("returns nil lookup for unknown spec", function() expect(BIS:GetBISList("PRIEST", "Nonexistent", "T6")).toBeNil() end) end) describe("known T6 spot checks", function() it("shadow priest T6 head is the Hyjal token", function() local list = BIS:GetBISList("PRIEST", "Shadow", "T6") expect(list["Head"].itemID).toEqual(31064) expect(list["Head"].name).toEqual("Hood of Absolution") end) it("discipline priest shares the holy T6 list", function() expect(BIS:GetBISList("PRIEST", "Discipline", "T6")) .toEqual(BIS:GetBISList("PRIEST", "Holy", "T6")) end) it("hunter BM and MM share the T6 list", function() expect(BIS:GetBISList("HUNTER", "Beast Mastery", "T6")) .toEqual(BIS:GetBISList("HUNTER", "Marksmanship", "T6")) end) it("all three warlock specs share the T6 list", function() local affliction = BIS:GetBISList("WARLOCK", "Affliction", "T6") expect(BIS:GetBISList("WARLOCK", "Demonology", "T6")).toEqual(affliction) expect(BIS:GetBISList("WARLOCK", "Destruction", "T6")).toEqual(affliction) end) end) describe("T4 (Phase 1) data", function() it("covers every spec", function() for _, class in ipairs(BIS:GetAvailableClasses()) do for _, spec in ipairs(BIS:GetAvailableSpecs(class)) do local list = BIS:GetBISList(class, spec, "T4") expect(list).toBeTruthy() end end end) it("uses Karazhan/Gruul/Magtheridon gear", function() local list = BIS:GetBISList("PRIEST", "Shadow", "T4") expect(list["Head"].itemID).toEqual(24266) expect(list["MainHand"].name).toEqual("Nathrezim Mindblade") expect(list["MainHand"].source).toEqual("Karazhan - Prince Malchezaar") end) it("paladin protection prot has no T5 entry", function() local phases = BIS:GetAvailablePhases("PALADIN", "Protection") expect(phases[1]).toEqual("T4") expect(phases[2]).toEqual("T6") expect(BIS:GetBISList("PALADIN", "Protection", "T5")).toBeNil() end) end) describe("T5 (Phase 2) data", function() it("shadow priest T5 trinket is current site data", function() local list = BIS:GetBISList("PRIEST", "Shadow", "T5") expect(list["Trinket1"].itemID).toEqual(27683) expect(list["Trinket1"].name).toEqual("Quagmirran's Eye") end) it("warlock T5 splits between affliction and demonology/destruction", function() local affliction = BIS:GetBISList("WARLOCK", "Affliction", "T5") local demonology = BIS:GetBISList("WARLOCK", "Demonology", "T5") local destruction = BIS:GetBISList("WARLOCK", "Destruction", "T5") expect(affliction["Shoulder"].name).toEqual("Mantle of the Corruptor") expect(demonology["Shoulder"].name).toEqual("Voidheart Mantle") expect(demonology).toEqual(destruction) local count = 0 for _ in pairs(affliction) do count = count + 1 end expect(count >= 15).toBeTruthy() end) end) describe("ZA (Phase 4) data", function() it("covers every spec", function() for _, class in ipairs(BIS:GetAvailableClasses()) do for _, spec in ipairs(BIS:GetAvailableSpecs(class)) do local list = BIS:GetBISList(class, spec, "ZA") expect(list).toBeTruthy() end end end) it("shadow priest ZA neck comes from Zul'jin", function() local list = BIS:GetBISList("PRIEST", "Shadow", "ZA") expect(list["Neck"].itemID).toEqual(33466) expect(list["Neck"].name).toEqual("Loop of Cursed Bones") expect(list["Neck"].source).toEqual("Zul'Aman - Zul'jin") end) it("hunter BM and MM share the ZA list", function() local bm = BIS:GetBISList("HUNTER", "Beast Mastery", "ZA") expect(BIS:GetBISList("HUNTER", "Marksmanship", "ZA")).toEqual(bm) expect(bm["Trinket0"].name).toEqual("Berserker's Call") expect(bm["Trinket0"].source).toEqual("Zul'Aman - Zul'jin") end) it("discipline priest shares the holy ZA list", function() expect(BIS:GetBISList("PRIEST", "Discipline", "ZA")) .toEqual(BIS:GetBISList("PRIEST", "Holy", "ZA")) end) it("all three warlock specs share the ZA list", function() local affliction = BIS:GetBISList("WARLOCK", "Affliction", "ZA") expect(BIS:GetBISList("WARLOCK", "Demonology", "ZA")).toEqual(affliction) expect(BIS:GetBISList("WARLOCK", "Destruction", "ZA")).toEqual(affliction) end) it("every list includes at least one Zul'Aman drop", function() for _, class in ipairs(BIS:GetAvailableClasses()) do for _, spec in ipairs(BIS:GetAvailableSpecs(class)) do local list = BIS:GetBISList(class, spec, "ZA") local found = false for _, entry in pairs(list) do if entry.source:find("Zul'Aman", 1, true) then found = true break end end expect(found).toBeTruthy() end end end) it("excludes items that are not available until Sunwell", function() local list = BIS:GetBISList("PALADIN", "Holy", "ZA") expect(list["MainHand"].itemID).toEqual(32500) expect(list["MainHand"].name).toEqual("Crystal Spire of Karabor") end) end) describe("source formatting", function() it("dash-joins quest rewards", function() local list = BIS:GetBISList("PRIEST", "Holy", "T5") expect(list["Neck"].source).toEqual("Quest Reward - Kael'thas and the Verdant Sphere") end) it("dash-joins heroic dungeon bosses", function() local list = BIS:GetBISList("DRUID", "Balance", "T5") expect(list["Trinket1"].source).toEqual("Slave Pens (H) - Quagmirran") end) it("space-joins profession vendors", function() local list = BIS:GetBISList("DRUID", "Balance", "T5") expect(list["Legs"].source).toEqual("Tailoring BoP Pattern (375)") end) end)