Files
WoW-Hybrid-gateway/tests/talent_description_tokens_test.lua
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

48 lines
2.4 KiB
Lua

-- Source-value authority: talent-tooltip-data-support exact ranks/child and duration receipts.
dofile("client_addons/GatewayDiagnostics/TurtleTalentProvider.lua")
local P=GatewayTurtleTalentProvider
local checks=0
local function expect(record,refs,want)
local got,issues=P.FormatDescription(record,refs or {})
assert(got==want,"description mismatch: "..tostring(got).." ~= "..want)
assert(#issues==0,"resolved description retained an issue")
checks=checks+1
end
local function held(record,refs)
local got,issues=P.FormatDescription(record,refs or {})
assert(got==record.description,"unsupported expression was partially rewritten")
assert(#issues>0,"unsupported expression lost its hold")
checks=checks+1
end
local function periodic(id,base,sides,duration,period)
return {id=id,durationMs=duration,effects={{basePoints=base,dieSides=sides,
pointsPerLevel=0,dicePerLevel=0,amplitudeMs=period}}}
end
-- Actual cached source child: Aura20, base1+die1, 6000/2000 -> nominal total6.
local blood=periodic(16491,1,1,6000,2000)
expect({id=16492,description="Regenerates $16491o1% of total Health over 6 seconds."},
{[16491]=blood},"Regenerates 6% of total Health over 6 seconds.")
local ranks={12322,12999,13000,13001,13002}
local chances={15,30,45,60,75}
for i,id in ipairs(ranks)do
expect({id=id,procChance=chances[i],description="Gives a $h1% chance."},nil,
"Gives a "..chances[i].."% chance.")
end
expect({id=900,description="$12322h1%"},{[12322]={id=12322,procChance=15}},"15%")
expect({id=900,description="$/2;16491o1"},{[16491]=blood},"3")
local simple=periodic(901,5,1,6000,2000)
simple.description="$s1/$t1/$d: $o1";expect(simple,nil,"6/2/6 sec: 18")
local range=periodic(902,2,3,4000,2000)
range.description="$m1/$M1: $o1";expect(range,nil,"3/5: 6 to 10")
local fractional=periodic(903,1,1,7000,2000);fractional.description="$o1";held(fractional)
local permanent=periodic(904,1,1,-1,2000);permanent.description="$o1";held(permanent)
local zero=periodic(905,1,1,6000,0);zero.description="$o1";held(zero)
local scaled=periodic(906,1,1,6000,2000);scaled.effects[1].pointsPerLevel=1
scaled.description="$o1";held(scaled)
local huge=periodic(907,2147483647,2147483647,2147483647,1)
huge.description="$o1";held(huge)
held({id=908,procChance=15,description="$h2%"})
held({id=908,procChance=15,description="$h12%"})
held({id=909,description="$16491o1"})
print("PASS source talent description token batch ("..checks.." cases)")