|
1 | 1 | describe("TradeQuery Currency Conversion", function() |
2 | | - local mock_tradeQuery = new("TradeQuery", { itemsTab = {} }) |
| 2 | + local mock_tradeQuery |
3 | 3 |
|
| 4 | + before_each(function() |
| 5 | + mock_tradeQuery = new("TradeQuery", { itemsTab = {} }) |
| 6 | + end) |
4 | 7 | -- test case for commit: "Skip callback on errors to prevent incomplete conversions" |
5 | 8 | describe("FetchCurrencyConversionTable", function() |
6 | 9 | -- Pass: Callback not called on error |
@@ -40,15 +43,19 @@ describe("TradeQuery Currency Conversion", function() |
40 | 43 | end) |
41 | 44 |
|
42 | 45 | describe("PriceBuilderProcessPoENinjaResponse", function() |
43 | | - -- Pass: Processes without error, restoring map |
| 46 | + -- Pass: Processes without error, restoring map while adding a notice |
44 | 47 | -- Fail: Corrupts map or crashes, indicating fragile API response handling, breaking future conversions |
45 | 48 | it("handles unmapped currency", function() |
46 | 49 | local orig_conv = mock_tradeQuery.currencyConversionTradeMap |
47 | 50 | mock_tradeQuery.currencyConversionTradeMap = { div = "id" } |
| 51 | + mock_tradeQuery.pbLeague = "league" |
| 52 | + mock_tradeQuery.pbCurrencyConversion = { league = {} } |
| 53 | + mock_tradeQuery.controls.pbNotice = { label = "" } |
48 | 54 | local resp = { exotic = 10 } |
49 | 55 | mock_tradeQuery:PriceBuilderProcessPoENinjaResponse(resp) |
50 | 56 | -- No crash expected |
51 | 57 | assert.is_true(true) |
| 58 | + assert.is_true(mock_tradeQuery.controls.pbNotice.label == "No currencies received from PoE Ninja") |
52 | 59 | mock_tradeQuery.currencyConversionTradeMap = orig_conv |
53 | 60 | end) |
54 | 61 | end) |
|
0 commit comments