feat(scripting): connect give_item to wallet rewards, add [E] Interact prompt and toast feedback
checkpoint / checkpoint (push) Failing after 6m2s
checkpoint / checkpoint (push) Failing after 6m2s
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user