Skip to content

Test Cheat Sheet

Valentin Jubert edited this page Oct 25, 2024 · 3 revisions

Test Actions / Utilities

Name Example Test Note
player.clickCard() Wing Leader Clicks a card. Will throw an error if there is no response to the click.
player.clickPrompt() Yoda Clicks a prompt button (not a card)
player.passAction() Snowtrooper Lieutenant Player passes their current action in the action phase.
this.moveToNextActionPhase() Disarm All players pass and then the game fast-forwards to the next action phase. No cards will be resourced.
player.clickCardNonChecking() Medal Ceremony Same as clickCard() except it will not throw an error if nothing happens on click. Used for testing when a click is expected to do nothing.
player.setDeck(), player.setSpaceArenaUnits(),
player.setGroundArenaUnits(), player.setDiscard()
Search Your Feelings,
Death Trooper
Set the units in an arena or card pile to override the initial test setup. Can use string names or existing card objects.
player.setResourceCount() Leader card tests Change the player's number of resources, overriding the test setup. If cards are added, they will be of the filler card type.
player.setResourceCards() N/A currently Set the player's resource zone to the specified cards.
player.findCardByName() Avenger Get the object reference for a specific card of a player's. Useful when the test harness cannot automatically create a this.<card> reference (typically when there is multiple of a single card).

Custom Expectations

Name Example Test Note
toHavePrompt Mon Mothma Checks if the prompt's name or text matches (but not buttons)
toHaveEnabledPromptButton(s) Mon Mothma Checks if the prompt button is present and in an enabled state
toHaveDisabledPromptButton(s) Mon Mothma Checks if the prompt button is present and in a disabled state
toBeAbleToSelectExactly Surprise Strike Checks that that specified player is able to select exactly the specified set of cards, no more and no less.
toBeInLocation I Am Your Father Checks that the provided card is in the specified game zone. Use this instead of expect(<card>.location).toBe(...) because it will check for inconsistency in game state.
toHaveExactUpgradeNames TIE Advanced Checks that the names of the provided card's upgrades match the provided list of card names.
toHaveAvailableActionWhenClickedBy Salacious Crumb Checks that the card, when clicked, causes an action to happen. Since this expectation changes game state, only use it at the end of a test (unless using the .not form)
toBeActivePlayer Fleet Lieutenant Checks that the selected player is active player (i.e., is currently choosing or resolving their action)
toHavePassAbilityButton The Force is With Me Checks that the selected player's current prompt includes the "Pass ability" button (typically used with target selectors)
toHavePassAbilityPrompt Superlaser Technician Checks that the selected player's current prompt is the prompt to pass an ability
toBeAbleToSelect N/A Checks if the card is one of the cards selectable by the specified player. Better in most cases to use toBeAbleToSelectExactly as it will fail if there are other selectable cards.
toBeAbleToSelectAllOf N/A Checks if the cards are a subset of the cards selectable by the specified player. Better in most cases to use toBeAbleToSelectExactly as it will fail if there are other selectable cards.
toBeAbleToSelectNoneOf N/A Checks that the player cannot select any of the specified cards. Better in most cases to use toBeAbleToSelectExactly to specify the exact set of expected cards.
toBeInBottomOfDeck Mon Mothma Checks that the selected card is in the bottom N cards of the deck
toAllBeInBottomOfDeck Mon Mothma Checks that the selected cards are in the bottom N cards of the deck