Skip to content

Commit

Permalink
test: use namespaced GetSpellInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainrider committed Oct 19, 2024
1 parent 0cce77e commit 84ac3ce
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,40 +102,40 @@ function testRegisterSpells:test_unknown_flag()
end

function testRegisterSpells:test_unknown_spell()
when(G.GetSpellInfo(4)).thenAnswer(false)
when(G.C_Spell.GetSpellInfo(4)).thenAnswer(false)
local success, msg = pcall(lib.__RegisterSpells, lib, "HUNTER", 1, 1, { [4] = "AURA" })
lu.assertEquals(success, true)
lu.assertEquals(msg, 1)
verify(G.GetSpellInfo(4))
verify(G.C_Spell.GetSpellInfo(4))
end

function testRegisterSpells:test_consistent_data()
when(G.GetSpellInfo(any())).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(any())).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, {[4] = "AURA", [5] = "AURA"}, {[4] = 8}, {[5] = 6})
end

function testRegisterSpells:test_known_spell()
when(G.GetSpellInfo(4)).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(4)).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "AURA" })
verify(G.GetSpellInfo(4))
verify(G.C_Spell.GetSpellInfo(4))
end

function testRegisterSpells:test_key_id_value_flag()
when(G.GetSpellInfo(4)).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(4)).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "AURA" })
lu.assertEquals(lib.__categories.HUNTER[4], bor(lib.constants.AURA, lib.constants.HUNTER))
end

function testRegisterSpells:test_spell_list()
when(G.GetSpellInfo(any())).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(any())).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { AURA = { 4, 5 } })
local db, c = lib.__categories.HUNTER, lib.constants
lu.assertEquals(db[4], bor(c.AURA, c.HUNTER))
lu.assertEquals(db[5], bor(c.AURA, c.HUNTER))
end

function testRegisterSpells:test_nested()
when(G.GetSpellInfo(any())).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(any())).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, {
AURA = {
4,
Expand All @@ -154,7 +154,7 @@ function testRegisterSpells:test_nested()
end

function testRegisterSpells:test_multipart_string()
when(G.GetSpellInfo(4)).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(4)).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "HELPFUL AURA" })
local db, c = lib.__categories.HUNTER, lib.constants
lu.assertEquals(db[4], bor(c.AURA, c.HELPFUL, c.HUNTER))
Expand All @@ -166,7 +166,7 @@ function testRegisterSpells:test_invalid_data()
end

function testRegisterSpells:test_database_conflict()
when(G.GetSpellInfo(4)).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(4)).thenAnswer("link")
when(G.GetBuildInfo()).thenAnswer({4,4,4,4})
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "AURA" })
local msg
Expand All @@ -178,15 +178,15 @@ function testRegisterSpells:test_database_conflict()
end

function testRegisterSpells:test_crowd_ctrl()
when(G.GetSpellInfo(any())).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(any())).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "AURA HARMFUL CROWD_CTRL STUN" })
local c = lib.constants
lu.assertEquals(lib.__specials.CROWD_CTRL[4], c.STUN)
lu.assertEquals(lib.__categories.HUNTER[4], bor(c.HARMFUL, c.AURA, c.HUNTER, c.CROWD_CTRL))
end

function testRegisterSpells:test_dispel()
when(G.GetSpellInfo(any())).thenAnswer("link")
when(G.C_Spell.GetSpellInfo(any())).thenAnswer("link")
lib:__RegisterSpells("HUNTER", 1, 1, { [4] = "DISPEL HARMFUL MAGIC" })
local c = lib.constants
lu.assertEquals(lib.__specials.DISPEL[4], c.MAGIC)
Expand Down

0 comments on commit 84ac3ce

Please sign in to comment.