Skip to content

Commit 05e9a15

Browse files
committed
port most compatible trader tool changes directly
1 parent 17cec65 commit 05e9a15

4 files changed

Lines changed: 228 additions & 93 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)

0 commit comments

Comments
 (0)