Skip to content

Commit

Permalink
Merge branch 'release/3.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Jul 23, 2024
2 parents 2cab5f3 + 3b43c96 commit fae6cac
Show file tree
Hide file tree
Showing 53 changed files with 2,565 additions and 1,323 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}
# WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
WAGO_API_TOKEN: ${{ secrets.WAGO_API_KEY }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}

steps:
Expand Down
76 changes: 47 additions & 29 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ exclude_files = {
files[".specs/**/*.spec.lua"].std = "+busted"
-- Don't report everything for our test files
files["__tests/**/*.lua"].ignore = {
"113/_", -- Accessing an undefined variable
"211", -- Unused local variable.
"213", -- Unused loop variable.
"241", -- Local variable is mutated but never accessed.
"423", -- Shadowing a loop variable.
}

ignore = {
"111/_", -- Setting an undefined (_) global variable.
"113/LE_.*", -- Accessing an undefined (Lua ENUM type) global variable
"113/NUM_LE_.*",-- Accessing an undefined (Lua ENUM type) global variable
"131", -- Unused implicitly defined global variable.
"143/string", -- Accessing an undefined field of a global variable.
"212", -- Unused argument.
"111/_", -- Setting an undefined (_) global variable.
"113/LE_.*", -- Accessing an undefined (Lua ENUM type) global variable
"113/NUM_LE_.*",-- Accessing an undefined (Lua ENUM type) global variable
"131", -- Unused implicitly defined global variable.
"143/string", -- Accessing an undefined field of a global variable.
"212", -- Unused argument.
"213", -- Unused loop variable.
"412", -- Redefining an argument.
"421/data", -- Shadowing a local variable (data).
"431", -- Shadowing an upvalue.
Expand All @@ -34,6 +35,7 @@ ignore = {
globals = {
"_G",
"bit",
"lfs",

-- misc custom
"AceGUIWeakAurasMultiLineEditBoxInsertLink",
Expand All @@ -44,42 +46,52 @@ globals = {
"RCLootCouncilML",
"RCTokenTable",
"RCTokenClasses",

-- Third Party Addons/Libs
"BigWigs",
"BigWigsLoader",
"BugGrabber",
"DBM",
"ElvUIPlayerNamePlateAnchor",
"GTFO",
"IndentationLib",
"KuiNameplatesCore",
"KuiNameplatesPlayerAnchor",
"WoWAPI_FireUpdate",
"WoWAPI_FireEvent",

-- Third Party Addons/Libs
"BigWigs",
"BigWigsLoader",
"BugGrabber",
"DBM",
"ElvUIPlayerNamePlateAnchor",
"GTFO",
"IndentationLib",
"KuiNameplatesCore",
"KuiNameplatesPlayerAnchor",
"MSA_DropDownMenu_AddButton",
"MSA_DropDownMenu_CreateInfo",
"MSA_DropDownMenu_Initialize",
"MSA_DROPDOWNMENU_MENU_VALUE",
"MSA_DropDownMenu_SetSelectedName",
"MSA_ToggleDropDownMenu",
"DevTool",
"CanIMogIt",

-- FrameXML misc
"AccumulateOp",
"C_Timer",
"ChatFrame_AddMessageEventFilter",
"Clamp",
"COMBAT_TEXT_SCROLL_FUNCTION",
"CombatLogGetCurrentEventInfo",
"CombatText_AddMessage",
"ContainsIf",
"CooldownFrame_Set",
"CreateAtlasMarkup",
"CreateColor",
"CreateFromMixins",
"CreateObjectPool",
"CreateSimpleTextureMarkup",
"CreateTextureMarkup",
"DEFAULT_CHAT_FRAME",
"GameTooltip_Hide",
"GameTooltip_SetDefaultAnchor",
"GameTooltip_UnitColor",
"GetClassColorObj",
"Lerp",
"Mixin",
"MergeTable",
"Round",
"Saturate",
"SecureButton_GetModifiedUnit",
Expand All @@ -96,6 +108,7 @@ globals = {
"tFilter",
"tIndexOf",
"tInvert",
"tInsertUnique",
"UIDropDownMenu_AddButton",
"UIDropDownMenu_Initialize",
"UISpecialFrames",
Expand Down Expand Up @@ -156,6 +169,8 @@ globals = {
"NUM_TALENT_COLUMNS",
"RED_FONT_COLOR_CODE",
"STANDARD_TEXT_FONT",
"ChatFrame1",
"UIDROPDOWNMENU_OPEN_MENU",

-- ENUMS
"LOWER_LEFT_VERTEX",
Expand All @@ -164,19 +179,21 @@ globals = {
"UPPER_RIGHT_VERTEX",

-- Namespaces
"C_EncounterJournal",
"C_DateAndTime",
"C_Container",
"C_CurrencyInfo",
"C_Item",
"C_Map",
"C_PartyInfo",
"C_PlayerInfo",
"C_System",
"C_Unit",
"C_AccountInfo",
"C_Club",
"C_Covenants",
"Settings",
"C_TooltipInfo",
"Settings",
"C_Container",
"C_CurrencyInfo",
"C_DateAndTime",
"C_EncounterJournal",
"C_Item",
"C_Map",
"C_PartyInfo",
"C_PlayerInfo",
"C_System",
"C_Unit",

-- API functions
"AbandonSkill",
Expand Down Expand Up @@ -3696,6 +3713,7 @@ globals = {
"math.log10",
"math.max",
"math.min",
"math.mod",
"math.modf",
"math.pow",
"math.rad",
Expand Down
193 changes: 99 additions & 94 deletions .specs/Classes/Data/Council.spec.lua
Original file line number Diff line number Diff line change
@@ -1,111 +1,116 @@
require "busted.runner"()
require "busted.runner" ()
local addonName, addon = "RCLootCouncil_Test", {
db = {global = { log = {}, cache = {}}},
defaults = { global = {logMaxEntries = 2000}}
db = { global = { log = {}, cache = {}, }, },
defaults = { global = { logMaxEntries = 2000, }, },
}

loadfile(".specs/AddonLoader.lua")(nil, addonName, addon).LoadArray{
[[Libs\LibStub\LibStub.lua]],
[[Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml]],
[[Libs\AceEvent-3.0\AceEvent-3.0.xml]],
[[Libs\AceLocale-3.0\AceLocale-3.0.xml]],
[[Classes/Core.lua]],
[[Classes/Utils/TempTable.lua]],
[[Classes/Utils/Log.lua]],
[[Locale\enUS.lua]],
"Classes/Utils/Item.lua",
[[Utils\Utils.lua]],
[[Classes/Services/ErrorHandler.lua]],
[[Classes/Data/Player.lua]],
[[Classes/Data/Council.lua]],
loadfile(".specs/AddonLoader.lua")(nil, addonName, addon).LoadArray {
[[Libs\LibStub\LibStub.lua]],
[[Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml]],
[[Libs\AceEvent-3.0\AceEvent-3.0.xml]],
[[Libs\AceLocale-3.0\AceLocale-3.0.xml]],
[[Classes/Core.lua]],
[[Classes/Utils/TempTable.lua]],
[[Classes/Utils/Log.lua]],
[[Locale\enUS.lua]],
"Classes/Utils/Item.lua",
[[Utils\Utils.lua]],
[[Classes/Services/ErrorHandler.lua]],
[[Classes/Data/Player.lua]],
[[Classes/Data/Council.lua]],
}

addon:InitLogging()
describe("#Council", function()
local Council
before_each(function()
Council = addon.Require "Data.Council"
end)
addon.candidatesInGroup = setmetatable({}, {
__index = function()
return true -- Any name we send is in our "group"
end,
})
local Council
before_each(function()
Council = addon.Require "Data.Council"
end)

describe("init", function()
it("should create 'Data.Council' module", function()
assert.not_nil(Council)
assert.is.table(Council)
end)
describe("init", function()
it("should create 'Data.Council' module", function()
assert.not_nil(Council)
assert.is.table(Council)
end)

it("should have certain functions", function()
assert.is.Function(Council.Get)
assert.is.Function(Council.Set)
assert.is.Function(Council.GetNum)
assert.is.Function(Council.Add)
assert.is.Function(Council.Remove)
assert.is.Function(Council.Contains)
assert.is.Function(Council.GetForTransmit)
assert.is.Function(Council.RestoreFromTransmit)
end)
end)
it("should have certain functions", function()
assert.is.Function(Council.Get)
assert.is.Function(Council.Set)
assert.is.Function(Council.GetNum)
assert.is.Function(Council.Add)
assert.is.Function(Council.Remove)
assert.is.Function(Council.Contains)
assert.is.Function(Council.GetForTransmit)
assert.is.Function(Council.RestoreFromTransmit)
end)
end)

describe("Class", function()
local Player = addon.Require "Data.Player"
it("should set the council", function()
assert.are.same({}, Council:Get())
assert.are.equal(0, Council:GetNum())
local newCouncil = {
[Player:Get("Player1").guid] = Player:Get("Player1")
}
Council:Set(newCouncil)
assert.are.equal(1, Council:GetNum())
assert.are.equal(newCouncil, Council:Get())
end)
describe("Class", function()
local Player = addon.Require "Data.Player"
it("should set the council", function()
assert.are.same({}, Council:Get())
assert.are.equal(0, Council:GetNum())
local newCouncil = {
[Player:Get("Player1").guid] = Player:Get("Player1"),
}
Council:Set(newCouncil)
assert.are.equal(1, Council:GetNum())
assert.are.equal(newCouncil, Council:Get())
end)

it("should create transmitable table", function()
local expected = {
["1-00000001"] = true
}
Council:Add(Player:Get("Player1"))
assert.are.same(expected, Council:GetForTransmit())
end)
it("should create transmitable table", function()
local expected = {
["1-00000001"] = true,
}
Council:Add(Player:Get("Player1"))
assert.are.same(expected, Council:GetForTransmit())
end)

it("transmitted table should be restoreable", function()
local transmit = Council:GetForTransmit()
Council:Add(Player:Get("Player1"))
Council:Set{} -- set empty
assert.are.equal(1, Council:RestoreFromTransmit(transmit))
end)
it("transmitted table should be restoreable", function()
local transmit = Council:GetForTransmit()
Council:Add(Player:Get("Player1"))
Council:Set {} -- set empty
assert.are.equal(1, Council:RestoreFromTransmit(transmit))
end)

it("should add players to the council", function()
Council:Set{} -- Start fresh
Council:Add(Player:Get("Player1"))
Council:Add(Player:Get("Player2"))
assert.are.equal(2, Council:GetNum())
end)
it("should add players to the council", function()
Council:Set {} -- Start fresh
Council:Add(Player:Get("Player1"))
Council:Add(Player:Get("Player2"))
assert.are.equal(2, Council:GetNum())
end)

it("should handle contains", function()
Council:Set{}
Council:Add(Player:Get("Player1"))
assert.True(Council:Contains(Player:Get("Player1")))
assert.False(Council:Contains(Player:Get("Player2")))
end)
it("should handle contains", function()
Council:Set {}
Council:Add(Player:Get("Player1"))
assert.True(Council:Contains(Player:Get("Player1")))
assert.False(Council:Contains(Player:Get("Player2")))
end)

it("should handle remove", function()
Council:Set{}
Council:Add(Player:Get("Player1"))
Council:Add(Player:Get("Player2"))
assert.are.equal(2, Council:GetNum())
assert.True(Council:Contains(Player:Get("Player1")))
assert.True(Council:Contains(Player:Get("Player2")))
Council:Remove(Player:Get("Player1"))
assert.False(Council:Contains(Player:Get("Player1")))
assert.are.equal(1, Council:GetNum())
end)
it("should handle remove", function()
Council:Set {}
Council:Add(Player:Get("Player1"))
Council:Add(Player:Get("Player2"))
assert.are.equal(2, Council:GetNum())
assert.True(Council:Contains(Player:Get("Player1")))
assert.True(Council:Contains(Player:Get("Player2")))
Council:Remove(Player:Get("Player1"))
assert.False(Council:Contains(Player:Get("Player1")))
assert.are.equal(1, Council:GetNum())
end)

it("should error out on invalid player object", function()
assert.has.errors(function()
Council:Add("test")
end, "Not a valid 'Player' object")
assert.has.errors(function()
Council:Remove{}
end, "Not a valid 'Player' object")
end)
end)
it("should error out on invalid player object", function()
assert.has.errors(function()
Council:Add("test")
end, "Not a valid 'Player' object")
assert.has.errors(function()
Council:Remove {}
end, "Not a valid 'Player' object")
end)
end)
end)
Loading

0 comments on commit fae6cac

Please sign in to comment.