feat(scripting): connect give_item to wallet rewards, add [E] Interact prompt and toast feedback
checkpoint / checkpoint (push) Failing after 6m2s

This commit is contained in:
2026-09-18 01:04:36 +00:00
parent 370395f1b6
commit f93e99f042
3 changed files with 144 additions and 1 deletions
+27
View File
@@ -133,3 +133,30 @@ async def test_wallet_service_credit_and_debit_flow():
# Newest first: debit (-400) first, then credit (+1000)
assert tx_data["transactions"][0]["amount"] == -400
assert tx_data["transactions"][1]["amount"] == 1000
def test_wallet_reward_endpoint():
client = TestClient(app)
uid, headers = _register(client, "wallet_reward_user")
# Initial balance is 0
resp = client.get("/api/wallet", headers=headers)
assert resp.status_code == 200
assert resp.json()["balance"] == 0
# Reward 25 Buffalo Chips
reward_resp = client.post(
"/api/wallet/reward",
json={"amount": 25, "reason": "found_chest"},
headers=headers,
)
assert reward_resp.status_code == 200
data = reward_resp.json()
assert data["success"] is True
assert data["amount"] == 25
assert data["new_balance"] == 25
# Check updated wallet
resp = client.get("/api/wallet", headers=headers)
assert resp.json()["balance"] == 25