RebuildStatRows hid the previous rows through vals.label, but StatValues never stored the label font string. The first spec change that altered the stat keys raised "attempt to index a nil value (field 'label')", aborting RefreshUI before the new rows were created. The previous spec's panel stayed on screen, so a Holy priest kept seeing Shadow's "+Spell Damage" row instead of "+Healing". Store the label in StatValues so old rows hide correctly and the panel rebuilds with the new spec's profile. Add a UI smoke test using mocked frames (font strings now record text/shown; frames track Show/Hide/IsShown). It switches Shadow -> Holy and asserts the visible rows change; with the bug reverted it fails with the same nil-label error. Also print usage for a bare "/amibis spec" instead of toggling the window, which was a surprising side effect and made tests order-dependent. 107 passing.
31 lines
1.1 KiB
Lua
31 lines
1.1 KiB
Lua
-- Offline test-suite entry point for Amibis.
|
|
--
|
|
-- Usage, from the repository root:
|
|
-- lua5.4 Amibis/Tests/run.lua
|
|
--
|
|
-- Requires only a Lua 5.3+ interpreter. No external libraries, no WoW client.
|
|
-- WoW API calls are mocked by wow_mocks.lua; SavedVariables globals are
|
|
-- stubbed below (in-game they are created by InitializeDB on ADDON_LOADED).
|
|
|
|
local ADDON_NAME = "Amibis"
|
|
local ns = {}
|
|
|
|
dofile("Amibis/Tests/harness.lua")
|
|
dofile("Amibis/Tests/wow_mocks.lua")
|
|
|
|
_G.AmibisDB = { selectedPhase = "T6" }
|
|
_G.AmibisCharDB = {}
|
|
|
|
assert(loadfile("Amibis/Amibis.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/Data/BISLists.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/UI/ComparisonFrame.lua"))(ADDON_NAME, ns)
|
|
|
|
assert(loadfile("Amibis/Tests/test_data.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/Tests/test_stats.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/Tests/test_compare.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/Tests/test_slash.lua"))(ADDON_NAME, ns)
|
|
assert(loadfile("Amibis/Tests/test_ui.lua"))(ADDON_NAME, ns)
|
|
|
|
local success = TestHarness_report()
|
|
os.exit(success and 0 or 1)
|