Skip to content

Commit

Permalink
Add tests for prioritize focus
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppzippy committed Mar 26, 2024
1 parent 929efb0 commit 71efea7
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Tests/ClassTargetSelectors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,19 +142,26 @@ 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

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
Expand Down

0 comments on commit 71efea7

Please sign in to comment.