Skip to content

Commit c1ec658

Browse files
committed
port compatible trader tool changes from pob1
1 parent 17cec65 commit c1ec658

5 files changed

Lines changed: 291 additions & 109 deletions

File tree

spec/System/TestTradeQueryCurrency_spec.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
describe("TradeQuery Currency Conversion", function()
2-
local mock_tradeQuery = new("TradeQuery", { itemsTab = {} })
2+
local mock_tradeQuery
33

4+
before_each(function()
5+
mock_tradeQuery = new("TradeQuery", { itemsTab = {} })
6+
end)
47
-- test case for commit: "Skip callback on errors to prevent incomplete conversions"
58
describe("FetchCurrencyConversionTable", function()
69
-- Pass: Callback not called on error
@@ -40,15 +43,19 @@ describe("TradeQuery Currency Conversion", function()
4043
end)
4144

4245
describe("PriceBuilderProcessPoENinjaResponse", function()
43-
-- Pass: Processes without error, restoring map
46+
-- Pass: Processes without error, restoring map while adding a notice
4447
-- Fail: Corrupts map or crashes, indicating fragile API response handling, breaking future conversions
4548
it("handles unmapped currency", function()
4649
local orig_conv = mock_tradeQuery.currencyConversionTradeMap
4750
mock_tradeQuery.currencyConversionTradeMap = { div = "id" }
51+
mock_tradeQuery.pbLeague = "league"
52+
mock_tradeQuery.pbCurrencyConversion = { league = {} }
53+
mock_tradeQuery.controls.pbNotice = { label = "" }
4854
local resp = { exotic = 10 }
4955
mock_tradeQuery:PriceBuilderProcessPoENinjaResponse(resp)
5056
-- No crash expected
5157
assert.is_true(true)
58+
assert.is_true(mock_tradeQuery.controls.pbNotice.label == "No currencies received from PoE Ninja")
5259
mock_tradeQuery.currencyConversionTradeMap = orig_conv
5360
end)
5461
end)

src/Classes/ItemsTab.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ local function isAugmentable(item)
14871487
return (item.sockets and #item.sockets > 0) or (item.base.socketLimit and item.base.socketLimit > 0)
14881488
end
14891489

1490-
function ItemsTabClass:copyAnointsAndAugments(newItem, copyAugments, overwrite, sourceSlotName)
1490+
function ItemsTabClass:CopyAnointsAndAugments(newItem, copyAugments, overwrite, sourceSlotName)
14911491
local isWeapon = newItem.base.tags and (newItem.base.tags.onehand or newItem.base.tags.twohand)
14921492
local isShield = newItem.base.tags and (newItem.base.tags.shield or newItem.base.tags.focus)
14931493
local newItemType = sourceSlotName or (isWeapon and "Weapon 1") or (isShield and "Weapon 2") or newItem.base.type
@@ -1552,7 +1552,7 @@ end
15521552
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
15531553
local newItem = new("Item", itemRaw)
15541554
if newItem.base then
1555-
self:copyAnointsAndAugments(newItem, main.migrateAugments, false)
1555+
self:CopyAnointsAndAugments(newItem, main.migrateAugments, false)
15561556
if normalise then
15571557
newItem:NormaliseQuality()
15581558
newItem:BuildModList()

0 commit comments

Comments
 (0)