1.7 KiB
1.7 KiB
Module 1 scenarios: Handles and order of play
Each heading is a test name. The Rust test lives in tests/rust/test_01.rs and the TypeScript test in tests/ts/test_01.test.ts; both state exactly what is written here. Every test starts from newGame() with no decks (new_game(GameOpts::default()) in Rust). All cards are Test Filler, a fictional test minion with no text. Player 0 is the first player, player 1 the second.
test_01_ids_stable_and_order_increases
- Setup: an empty game.
- Action: summon
Test Fillerfor player 0 and call its id A. RecordorderOfPlay(A). Then summon anotherTest Fillerfor player 0 and call its id B. - Assertions:
- A and B are different ids.
orderOfPlay(A) < orderOfPlay(B).orderOfPlay(A)is the same value it had before B was summoned.- A still names the same entity:
nameOf(A)is"Test Filler"andzoneOf(A)is board. board(0)is[A, B], left to right.
test_01_zones
- Setup: an empty game.
- Action: for player 0, add a
Test Fillerto the deck (id D), add aTest Fillerto the hand (id H), and summon aTest Filler(id S). - Assertions:
zoneOf(D)is deck,zoneOf(H)is hand,zoneOf(S)is board.hand(0)is[H].board(0)is[S].
test_01_board_query_per_player
- Setup: an empty game.
- Action: summon
Test Fillerfor player 0 (id A0), then for player 1 (id A1), then for player 0 again (id B0). - Assertions:
board(0)is[A0, B0].board(1)is[A1].
test_01_names
- Setup: an empty game.
- Action: summon
Test Fillerfor player 0 (id A) and add aTest Fillerto player 1's hand (id H). - Assertions:
nameOf(A)is"Test Filler".nameOf(H)is"Test Filler".