Commit eb34712
committed
test(lua): cover buy_and_use routes and fixtures
Add tests and fixtures for the buy_and_use endpoint, covering every
route the siblings (buy, use) exercise plus the faithfulness edge cases
specific to this endpoint:
- INVALID_STATE when not in SHOP
- BAD_REQUEST: missing card, empty shop, out-of-range index, unaffordable
- NOT_ALLOWED via the non-consumable guard (a Joker, which has no
Buy-and-Use button) and via the real can_use_consumeable gate (The
Magician, whose target-taking branch is SHOP-invisible)
- SUCCESS on a no-target Planet (used, not stored)
- SUCCESS when consumable slots are full — the #209 motivating case
- SUCCESS on Ankh-at-full-jokers: a faithful noop (money spent, no joker
created) that proves we do not over-gate with a check_use pre-call
- Type validation for the card parameter
Tests are deterministic: completion is event-based (trigger='condition'
polling), so no flaky marks are used — consistent with test_use.py and
test_pack.py and unlike the inconsistent legacy marks in test_buy.py.
Fixtures use deterministic seeds. The Ankh edge case needs a Spectral in
the shop, which the Red Deck can never roll (spectral_rate defaults to
0), so it uses the Ghost Deck (spectral_rate=2) under seed ANKH0001 with
53 rerolls to land c_ankh in slot 1.1 parent 4be8c16 commit eb34712
2 files changed
Lines changed: 769 additions & 0 deletions
0 commit comments