Skip to content

Commit 6d5187f

Browse files
committed
test(lua.endpoints): add test for mega packs with both selections requiring targets
1 parent 9f2fdc9 commit 6d5187f

2 files changed

Lines changed: 105 additions & 0 deletions

File tree

tests/fixtures/fixtures.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,79 @@
16121612
"pack": 1
16131613
}
16141614
}
1615+
],
1616+
"seed-VEBROR8--state-SMODS_BOOSTER_OPENED--pack.key-p_arcana_mega_1": [
1617+
{
1618+
"method": "menu",
1619+
"params": {}
1620+
},
1621+
{
1622+
"method": "start",
1623+
"params": {
1624+
"deck": "RED",
1625+
"stake": "WHITE",
1626+
"seed": "VEBROR8"
1627+
}
1628+
},
1629+
{
1630+
"method": "select",
1631+
"params": {}
1632+
},
1633+
{
1634+
"method": "set",
1635+
"params": {
1636+
"chips": 1000,
1637+
"money": 100
1638+
}
1639+
},
1640+
{
1641+
"method": "play",
1642+
"params": {
1643+
"cards": [
1644+
0
1645+
]
1646+
}
1647+
},
1648+
{
1649+
"method": "cash_out",
1650+
"params": {}
1651+
},
1652+
{
1653+
"method": "buy",
1654+
"params": {
1655+
"pack": 0
1656+
}
1657+
},
1658+
{
1659+
"method": "pack",
1660+
"params": {
1661+
"skip": true
1662+
}
1663+
},
1664+
{
1665+
"method": "buy",
1666+
"params": {
1667+
"pack": 0
1668+
}
1669+
},
1670+
{
1671+
"method": "pack",
1672+
"params": {
1673+
"skip": true
1674+
}
1675+
},
1676+
{
1677+
"method": "add",
1678+
"params": {
1679+
"key": "p_arcana_mega_1"
1680+
}
1681+
},
1682+
{
1683+
"method": "buy",
1684+
"params": {
1685+
"pack": 0
1686+
}
1687+
}
16151688
]
16161689
},
16171690
"sell": {

tests/lua/endpoints/test_pack.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,38 @@ def test_mega_pack_second_selection_closes(self, client: httpx.Client) -> None:
401401
gamestate = assert_gamestate_response(result, state="SHOP")
402402
assert "pack" not in gamestate
403403

404+
def test_mega_pack_both_selections_with_targets(self, client: httpx.Client) -> None:
405+
"""Test mega pack where both selections require targets.
406+
407+
Pack contents (seed VEBROR8):
408+
[0] c_wheel_of_fortune
409+
[1] c_sun
410+
[2] c_star
411+
[3] c_hanged_man - requires 2 targets (first selection)
412+
[4] c_chariot - requires 1 target (second selection)
413+
"""
414+
load_fixture(
415+
client,
416+
"pack",
417+
"seed-VEBROR8--state-SMODS_BOOSTER_OPENED--pack.key-p_arcana_mega_1",
418+
)
419+
420+
result = api(client, "pack", {"card": 3, "targets": [0, 1]})
421+
gamestate = assert_gamestate_response(result, state="SMODS_BOOSTER_OPENED")
422+
423+
# After first selection, pack should still be open (mega packs allow 2 selections)
424+
# The Hanged Man was removed, so cards shifted:
425+
# [0] c_wheel_of_fortune, [1] c_sun, [2] c_star, [3] c_chariot
426+
assert "pack" in gamestate
427+
assert len(gamestate["pack"]["cards"]) == 4
428+
429+
# Second selection: card index 3 is now c_chariot (requires 1 target)
430+
result = api(client, "pack", {"card": 3, "targets": [0]})
431+
gamestate = assert_gamestate_response(result, state="SHOP")
432+
433+
# After second selection, pack should be closed
434+
assert "pack" not in gamestate
435+
404436

405437
# =============================================================================
406438
# Skip Tests

0 commit comments

Comments
 (0)