fix: align badge labels with updated tier names
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m34s
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m34s
Tier badges shifted to match updated spec: T1=[BC] Base Chrome, T2=[R] Refractor, T3=[GR] Gold Refractor, T4=[SF] Superfractor T0 (Base Card) shows no badge. All 11 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fc8508fbd5
commit
cc02d6db1e
@ -115,8 +115,8 @@ async def get_card_embeds(card, include_stats=False) -> list:
|
||||
evo_state = await db_get(f"evolution/cards/{card['id']}")
|
||||
if evo_state and evo_state.get("current_tier", 0) > 0:
|
||||
tier = evo_state["current_tier"]
|
||||
TIER_BADGES = {1: "R", 2: "GR", 3: "SF"}
|
||||
tier_badge = f"[{TIER_BADGES.get(tier, 'SF★')}] "
|
||||
TIER_BADGES = {1: "BC", 2: "R", 3: "GR", 4: "SF"}
|
||||
tier_badge = f"[{TIER_BADGES.get(tier, 'SF')}] "
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@ -103,10 +103,22 @@ class TestTierBadgeFormat:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tier_one_badge(self):
|
||||
"""current_tier=1 should prefix title with [R] (Refractor)."""
|
||||
"""current_tier=1 should prefix title with [BC] (Base Chrome)."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 1, "card_id": 1}
|
||||
|
||||
with patch("helpers.main.db_get", new_callable=AsyncMock) as mock_db:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
|
||||
assert embeds[0].title == "[BC] Mike Trout"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tier_two_badge(self):
|
||||
"""current_tier=2 should prefix title with [R] (Refractor)."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 2, "card_id": 1}
|
||||
|
||||
with patch("helpers.main.db_get", new_callable=AsyncMock) as mock_db:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
@ -114,10 +126,10 @@ class TestTierBadgeFormat:
|
||||
assert embeds[0].title == "[R] Mike Trout"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tier_two_badge(self):
|
||||
"""current_tier=2 should prefix title with [GR] (Gold Refractor)."""
|
||||
async def test_tier_three_badge(self):
|
||||
"""current_tier=3 should prefix title with [GR] (Gold Refractor)."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 2, "card_id": 1}
|
||||
evo_state = {"current_tier": 3, "card_id": 1}
|
||||
|
||||
with patch("helpers.main.db_get", new_callable=AsyncMock) as mock_db:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
@ -125,21 +137,9 @@ class TestTierBadgeFormat:
|
||||
|
||||
assert embeds[0].title == "[GR] Mike Trout"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tier_three_badge(self):
|
||||
"""current_tier=3 should prefix title with [SF] (Superfractor)."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 3, "card_id": 1}
|
||||
|
||||
with patch("helpers.main.db_get", new_callable=AsyncMock) as mock_db:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
|
||||
assert embeds[0].title == "[SF] Mike Trout"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tier_four_superfractor_badge(self):
|
||||
"""current_tier=4 (fully evolved) should prefix title with [SF★]."""
|
||||
"""current_tier=4 (Superfractor) should prefix title with [SF]."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 4, "card_id": 1}
|
||||
|
||||
@ -147,7 +147,7 @@ class TestTierBadgeFormat:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
|
||||
assert embeds[0].title == "[SF★] Mike Trout"
|
||||
assert embeds[0].title == "[SF] Mike Trout"
|
||||
|
||||
|
||||
class TestTierBadgeInTitle:
|
||||
@ -163,16 +163,16 @@ class TestTierBadgeInTitle:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
|
||||
assert embeds[0].title.startswith("[GR] ")
|
||||
assert embeds[0].title.startswith("[R] ")
|
||||
assert "Juan Soto" in embeds[0].title
|
||||
|
||||
|
||||
class TestFullyEvolvedBadge:
|
||||
"""Unit: fully evolved card shows [SF★] badge."""
|
||||
"""Unit: fully evolved card shows [SF] badge (Superfractor)."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fully_evolved_badge(self):
|
||||
"""T4 card should show [SF★] prefix, not [T4]."""
|
||||
"""T4 card should show [SF] prefix, not [T4]."""
|
||||
card = _make_card()
|
||||
evo_state = {"current_tier": 4}
|
||||
|
||||
@ -180,7 +180,7 @@ class TestFullyEvolvedBadge:
|
||||
mock_db.side_effect = _patch_db_get(evo_response=evo_state)
|
||||
embeds = await _call_get_card_embeds(card)
|
||||
|
||||
assert embeds[0].title.startswith("[SF★] ")
|
||||
assert embeds[0].title.startswith("[SF] ")
|
||||
assert "[T4]" not in embeds[0].title
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user