Skip to content

Commit f2f1be3

Browse files
authored
Merge branch 'dev' into feature/imbued-support-implementation
2 parents 3f8d4c0 + 57cedf5 commit f2f1be3

133 files changed

Lines changed: 84425 additions & 45675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.busted

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
return {
22
_all = {
3-
coverage = true,
3+
coverage = false,
44
verbose = true,
55
},
66
default = {

.github/ISSUE_TEMPLATE/accuracy_bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Accuracy bug report
22
description: Create a bug report to help us fix incorrect wording in Path of Building for PoE1.
3-
labels: ["bug:accuracy"]
3+
labels: ["bug: accuracy"]
44
body:
55
- type: markdown
66
attributes:

.github/ISSUE_TEMPLATE/behaviour_bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Behaviour bug report
22
description: Create a bug report to help us fix incorrect behaviour or logic in Path of Building for PoE1.
3-
labels: ["bug:behaviour"]
3+
labels: ["bug: behaviour"]
44
body:
55
- type: markdown
66
attributes:

.github/ISSUE_TEMPLATE/calculation_bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Calculation bug report
22
description: Create a bug report to help us fix incorrect calculations in Path of Building for PoE1.
3-
labels: ["bug:calculation"]
3+
labels: ["bug: calculation"]
44
body:
55
- type: markdown
66
attributes:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515
- name: Run tests
16-
run: busted --lua=luajit --no-coverage
16+
run: busted --lua=luajit
1717
check_modcache:
1818
runs-on: ubuntu-latest
1919
container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
describe("TradeQuery Currency Conversion", function()
2-
local mock_tradeQuery = new("TradeQuery", { itemsTab = {} })
2+
local mock_tradeQuery = new("TradeQuery", { itemsTab = {} })
33

4-
-- test case for commit: "Skip callback on errors to prevent incomplete conversions"
5-
describe("FetchCurrencyConversionTable", function()
6-
-- Pass: Callback not called on error
7-
-- Fail: Callback called, indicating partial data risk
8-
it("skips callback on error", function()
9-
local orig_launch = launch
10-
local spy = { called = false }
11-
launch = {
12-
DownloadPage = function(url, callback, opts)
13-
callback(nil, "test error")
14-
end
15-
}
16-
mock_tradeQuery:FetchCurrencyConversionTable(function()
17-
spy.called = true
18-
end)
19-
launch = orig_launch
20-
assert.is_false(spy.called)
21-
end)
22-
end)
4+
-- test case for commit: "Skip callback on errors to prevent incomplete conversions"
5+
describe("FetchCurrencyConversionTable", function()
6+
-- Pass: Callback not called on error
7+
-- Fail: Callback called, indicating partial data risk
8+
it("skips callback on error", function()
9+
local orig_launch = launch
10+
local spy = { called = false }
11+
launch = {
12+
DownloadPage = function(url, callback, opts)
13+
callback(nil, "test error")
14+
end
15+
}
16+
mock_tradeQuery:FetchCurrencyConversionTable(function()
17+
spy.called = true
18+
end)
19+
launch = orig_launch
20+
assert.is_false(spy.called)
21+
end)
22+
end)
2323

24-
describe("ConvertCurrencyToChaos", function()
25-
-- Pass: Ceils amount to integer (e.g., 4.9 -> 5)
26-
-- Fail: Wrong value or nil, indicating broken rounding/baseline logic, causing inaccurate chaos totals
27-
it("handles chaos currency", function()
28-
mock_tradeQuery.pbCurrencyConversion = { league = { chaos = 1 } }
29-
mock_tradeQuery.pbLeague = "league"
30-
local result = mock_tradeQuery:ConvertCurrencyToChaos("chaos", 4.9)
31-
assert.are.equal(result, 5)
32-
end)
24+
describe("ConvertCurrencyToChaos", function()
25+
-- Pass: Ceils amount to integer (e.g., 4.9 -> 5)
26+
-- Fail: Wrong value or nil, indicating broken rounding/baseline logic, causing inaccurate chaos totals
27+
it("handles chaos currency", function()
28+
mock_tradeQuery.pbCurrencyConversion = { league = { chaos = 1 } }
29+
mock_tradeQuery.pbLeague = "league"
30+
local result = mock_tradeQuery:ConvertCurrencyToChaos("chaos", 4.9)
31+
assert.are.equal(result, 5)
32+
end)
3333

34-
-- Pass: Returns nil without crash
35-
-- Fail: Crashes or wrong value, indicating unhandled currencies, corrupting price conversions
36-
it("returns nil for unmapped", function()
37-
local result = mock_tradeQuery:ConvertCurrencyToChaos("exotic", 10)
38-
assert.is_nil(result)
39-
end)
40-
end)
34+
-- Pass: Returns nil without crash
35+
-- Fail: Crashes or wrong value, indicating unhandled currencies, corrupting price conversions
36+
it("returns nil for unmapped", function()
37+
local result = mock_tradeQuery:ConvertCurrencyToChaos("exotic", 10)
38+
assert.is_nil(result)
39+
end)
40+
end)
4141

42-
describe("PriceBuilderProcessPoENinjaResponse", function()
43-
-- Pass: Processes without error, restoring map
44-
-- Fail: Corrupts map or crashes, indicating fragile API response handling, breaking future conversions
45-
it("handles unmapped currency", function()
46-
local orig_conv = mock_tradeQuery.currencyConversionTradeMap
47-
mock_tradeQuery.currencyConversionTradeMap = { div = "id" }
48-
local resp = { exotic = 10 }
49-
mock_tradeQuery:PriceBuilderProcessPoENinjaResponse(resp)
50-
-- No crash expected
51-
assert.is_true(true)
52-
mock_tradeQuery.currencyConversionTradeMap = orig_conv
53-
end)
54-
end)
42+
describe("PriceBuilderProcessPoENinjaResponse", function()
43+
-- Pass: Processes without error, restoring map
44+
-- Fail: Corrupts map or crashes, indicating fragile API response handling, breaking future conversions
45+
it("handles unmapped currency", function()
46+
local orig_conv = mock_tradeQuery.currencyConversionTradeMap
47+
mock_tradeQuery.currencyConversionTradeMap = { div = "id" }
48+
local resp = { exotic = 10 }
49+
mock_tradeQuery:PriceBuilderProcessPoENinjaResponse(resp)
50+
-- No crash expected
51+
assert.is_true(true)
52+
mock_tradeQuery.currencyConversionTradeMap = orig_conv
53+
end)
54+
end)
5555

56-
describe("GetTotalPriceString", function()
57-
-- Pass: Sums and formats correctly (e.g., "5 chaos, 10 div")
58-
-- Fail: Wrong string (e.g., unsorted/missing sums), indicating aggregation bug, misleading users on totals
59-
it("aggregates prices", function()
60-
mock_tradeQuery.totalPrice = { { currency = "chaos", amount = 5 }, { currency = "div", amount = 10 } }
61-
local result = mock_tradeQuery:GetTotalPriceString()
62-
assert.are.equal(result, "5 chaos, 10 div")
63-
end)
64-
end)
56+
describe("GetTotalPriceString", function()
57+
-- Pass: Sums and formats correctly (e.g., "5 chaos, 10 div")
58+
-- Fail: Wrong string (e.g., unsorted/missing sums), indicating aggregation bug, misleading users on totals
59+
it("aggregates prices", function()
60+
mock_tradeQuery.totalPrice = { { currency = "chaos", amount = 5 }, { currency = "div", amount = 10 } }
61+
local result = mock_tradeQuery:GetTotalPriceString()
62+
assert.are.equal(result, "5 chaos, 10 div")
63+
end)
64+
end)
6565
end)
Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
describe("TradeQueryGenerator", function()
2-
local mock_queryGen = new("TradeQueryGenerator", { itemsTab = {} })
2+
local mock_queryGen = new("TradeQueryGenerator", { itemsTab = {} })
33

4-
describe("ProcessMod", function()
5-
-- Pass: Mod line maps correctly to trade stat entry without error
6-
-- Fail: Mapping fails (e.g., no match found), indicating incomplete stat parsing for curse mods, potentially missing curse-enabling items in queries
7-
it("handles special curse case", function()
8-
local mod = { "You can apply an additional Curse" }
9-
local tradeStatsParsed = { result = { [2] = { entries = { { text = "You can apply # additional Curses", id = "id" } } } } }
10-
mock_queryGen.modData = { Explicit = true }
11-
mock_queryGen:ProcessMod(mod, tradeStatsParsed, 1)
12-
-- Simplified assertion; in full impl, check modData
13-
assert.is_true(true)
14-
end)
15-
end)
4+
describe("ProcessMod", function()
5+
-- Pass: Mod line maps correctly to trade stat entry without error
6+
-- Fail: Mapping fails (e.g., no match found), indicating incomplete stat parsing for curse mods, potentially missing curse-enabling items in queries
7+
it("handles special curse case", function()
8+
local mod = { "You can apply an additional Curse" }
9+
local tradeStatsParsed = { result = { [2] = { entries = { { text = "You can apply # additional Curses", id = "id" } } } } }
10+
mock_queryGen.modData = { Explicit = true }
11+
mock_queryGen:ProcessMod(mod, tradeStatsParsed, 1)
12+
-- Simplified assertion; in full impl, check modData
13+
assert.is_true(true)
14+
end)
15+
end)
1616

17-
describe("WeightedRatioOutputs", function()
18-
-- Pass: Returns 0, avoiding math errors
19-
-- Fail: Returns NaN/inf or crashes, indicating unhandled infinite values, causing evaluation failures in infinite-scaling builds
20-
it("handles infinite base", function()
21-
local baseOutput = { TotalDPS = math.huge }
22-
local newOutput = { TotalDPS = 100 }
23-
local statWeights = { { stat = "TotalDPS", weightMult = 1 } }
24-
local result = mock_queryGen.WeightedRatioOutputs(baseOutput, newOutput, statWeights)
25-
assert.are.equal(result, 0)
26-
end)
17+
describe("WeightedRatioOutputs", function()
18+
-- Pass: Returns 0, avoiding math errors
19+
-- Fail: Returns NaN/inf or crashes, indicating unhandled infinite values, causing evaluation failures in infinite-scaling builds
20+
it("handles infinite base", function()
21+
local baseOutput = { TotalDPS = math.huge }
22+
local newOutput = { TotalDPS = 100 }
23+
local statWeights = { { stat = "TotalDPS", weightMult = 1 } }
24+
local result = mock_queryGen.WeightedRatioOutputs(baseOutput, newOutput, statWeights)
25+
assert.are.equal(result, 0)
26+
end)
2727

28-
-- Pass: Returns capped value (100), preventing division issues
29-
-- Fail: Returns inf/NaN, indicating unhandled zero base, leading to invalid comparisons in low-output builds
30-
it("handles zero base", function()
31-
local baseOutput = { TotalDPS = 0 }
32-
local newOutput = { TotalDPS = 100 }
33-
local statWeights = { { stat = "TotalDPS", weightMult = 1 } }
34-
data.misc.maxStatIncrease = 1000
35-
local result = mock_queryGen.WeightedRatioOutputs(baseOutput, newOutput, statWeights)
36-
assert.are.equal(result, 100)
37-
end)
38-
end)
28+
-- Pass: Returns capped value (100), preventing division issues
29+
-- Fail: Returns inf/NaN, indicating unhandled zero base, leading to invalid comparisons in low-output builds
30+
it("handles zero base", function()
31+
local baseOutput = { TotalDPS = 0 }
32+
local newOutput = { TotalDPS = 100 }
33+
local statWeights = { { stat = "TotalDPS", weightMult = 1 } }
34+
data.misc.maxStatIncrease = 1000
35+
local result = mock_queryGen.WeightedRatioOutputs(baseOutput, newOutput, statWeights)
36+
assert.are.equal(result, 100)
37+
end)
38+
end)
3939

40-
describe("Filter prioritization", function()
41-
-- Pass: Limits mods to MAX_FILTERS (2 in test), preserving top priorities
42-
-- Fail: Exceeds limit, indicating over-generation of filters, risking API query size errors or rate limits
43-
it("respects MAX_FILTERS", function()
44-
local orig_max = _G.MAX_FILTERS
45-
_G.MAX_FILTERS = 2
46-
mock_queryGen.modWeights = { { weight = 10, tradeModId = "id1" }, { weight = 5, tradeModId = "id2" } }
47-
table.sort(mock_queryGen.modWeights, function(a, b)
48-
return math.abs(a.weight) > math.abs(b.weight)
49-
end)
50-
local prioritized = {}
51-
for i, entry in ipairs(mock_queryGen.modWeights) do
52-
if #prioritized < _G.MAX_FILTERS then
53-
table.insert(prioritized, entry)
54-
end
55-
end
56-
assert.are.equal(#prioritized, 2)
57-
_G.MAX_FILTERS = orig_max
58-
end)
59-
end)
40+
describe("Filter prioritization", function()
41+
-- Pass: Limits mods to MAX_FILTERS (2 in test), preserving top priorities
42+
-- Fail: Exceeds limit, indicating over-generation of filters, risking API query size errors or rate limits
43+
it("respects MAX_FILTERS", function()
44+
local orig_max = _G.MAX_FILTERS
45+
_G.MAX_FILTERS = 2
46+
mock_queryGen.modWeights = { { weight = 10, tradeModId = "id1" }, { weight = 5, tradeModId = "id2" } }
47+
table.sort(mock_queryGen.modWeights, function(a, b)
48+
return math.abs(a.weight) > math.abs(b.weight)
49+
end)
50+
local prioritized = {}
51+
for i, entry in ipairs(mock_queryGen.modWeights) do
52+
if #prioritized < _G.MAX_FILTERS then
53+
table.insert(prioritized, entry)
54+
end
55+
end
56+
assert.are.equal(#prioritized, 2)
57+
_G.MAX_FILTERS = orig_max
58+
end)
59+
end)
6060
end)

0 commit comments

Comments
 (0)