From 71efea7a31b552a288dc93f462d5baeb2679c7a0 Mon Sep 17 00:00:00 2001 From: Kyle Scheuing Date: Tue, 26 Mar 2024 05:26:48 -0400 Subject: [PATCH] Add tests for prioritize focus --- Tests/ClassTargetSelectors.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Tests/ClassTargetSelectors.lua b/Tests/ClassTargetSelectors.lua index 958b2be..8e9a8ed 100644 --- a/Tests/ClassTargetSelectors.lua +++ b/Tests/ClassTargetSelectors.lua @@ -98,7 +98,20 @@ local tests = { { name = "a", role = "HEALER", isMainTank = false }, }, expected = { "a", "c" }, - } + }, + { + name = "Prioritize focus puts the focus first", + class = { "HUNTER", "ROGUE", "DRUID", "EVOKER" }, + prioritizeFocus = true, + group = { + { name = "a", role = "TANK" }, + { name = "b", role = "HEALER" }, + }, + expectedHUNTER = { "focusName", "a", "pet" }, + expectedROGUE = { "focusName", "a" }, + expectedEVOKER = { "focusName", "a", "player" }, + expectedDRUID = { "focusName", "b" }, + }, } ---@param unit string @@ -129,6 +142,9 @@ for _, test in ipairs(tests) do end function UnitName(unit) + if unit == "focus" then + return "focusName" + end local index = getUnitIndex(test, unit) return test.group[index] and test.group[index].name end @@ -136,12 +152,16 @@ for _, test in ipairs(tests) do function UnitGUID(unit) unit = unit:lower() if unit == "focus" then - return + return "focusGUID" end local index = getUnitIndex(test, unit) return test.group[index] and test.group[index].name .. "GUID" end + function IsGUIDInGroup(guid) + if guid == "focusGUID" then return true end + end + function UnitGroupRolesAssigned(unit) local index = getUnitIndex(test, unit) return test.group[index] and test.group[index].role