mtg-playerinfo 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/fetchers/untapped.js
CHANGED
|
@@ -59,6 +59,8 @@ class UntappedFetcher {
|
|
|
59
59
|
if (match.friendly_ranking_class_after === 'Mythic') {
|
|
60
60
|
if (match.friendly_mythic_leaderboard_place_after !== null && match.friendly_mythic_leaderboard_place_after !== undefined) {
|
|
61
61
|
return `Mythic #${match.friendly_mythic_leaderboard_place_after}`
|
|
62
|
+
} else if (match.friendly_mythic_percentile_after !== null && match.friendly_mythic_percentile_after !== undefined) {
|
|
63
|
+
return `Mythic ${Math.floor(match.friendly_mythic_percentile_after)}%`
|
|
62
64
|
}
|
|
63
65
|
return null
|
|
64
66
|
}
|
package/test/untapped.test.js
CHANGED
|
@@ -55,7 +55,7 @@ test('UntappedFetcher: handles missing rank data', () => {
|
|
|
55
55
|
assert.strictEqual('limited' in result.mtga_rank, false)
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
test('UntappedFetcher: formats Mythic rank with leaderboard place', () => {
|
|
58
|
+
test('UntappedFetcher: formats Mythic rank with leaderboard place or percentile', () => {
|
|
59
59
|
const fetcher = new UntappedFetcher()
|
|
60
60
|
const testMatches = [
|
|
61
61
|
{
|
|
@@ -63,13 +63,15 @@ test('UntappedFetcher: formats Mythic rank with leaderboard place', () => {
|
|
|
63
63
|
friendly_ranking_class_after: 'Mythic',
|
|
64
64
|
friendly_ranking_tier_after: null,
|
|
65
65
|
friendly_mythic_leaderboard_place_after: 123,
|
|
66
|
+
friendly_mythic_percentile_after: 101.5,
|
|
66
67
|
match_start: 1000
|
|
67
68
|
},
|
|
68
69
|
{
|
|
69
70
|
super_format: 1,
|
|
70
71
|
friendly_ranking_class_after: 'Mythic',
|
|
71
72
|
friendly_ranking_tier_after: null,
|
|
72
|
-
friendly_mythic_leaderboard_place_after:
|
|
73
|
+
friendly_mythic_leaderboard_place_after: null,
|
|
74
|
+
friendly_mythic_percentile_after: 98.789,
|
|
73
75
|
match_start: 2000
|
|
74
76
|
}
|
|
75
77
|
]
|
|
@@ -78,7 +80,7 @@ test('UntappedFetcher: formats Mythic rank with leaderboard place', () => {
|
|
|
78
80
|
const result = fetcher.parseMatches(testMatches, url)
|
|
79
81
|
|
|
80
82
|
assert.strictEqual(result.mtga_rank.constructed, 'Mythic #123')
|
|
81
|
-
assert.strictEqual(result.mtga_rank.limited, 'Mythic
|
|
83
|
+
assert.strictEqual(result.mtga_rank.limited, 'Mythic 98%')
|
|
82
84
|
})
|
|
83
85
|
|
|
84
86
|
test('UntappedFetcher: constructs correct API URL from two-part ID', () => {
|