added util fns - play-from-hand-with-prompt, click-prompts#7942
Merged
NBKelly merged 4 commits intomtgred:masterfrom Feb 26, 2025
Merged
added util fns - play-from-hand-with-prompt, click-prompts#7942NBKelly merged 4 commits intomtgred:masterfrom
NBKelly merged 4 commits intomtgred:masterfrom
Conversation
Collaborator
Author
|
I extended the play-with-prompt to take an arbitrary amount, just incase we need it later. Next step is adding the ability to pass in 1-fn's that act on state to select their element (this will be useful for any test which can be constructed as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added a couple of util fns to the test framework.
(play-from-hand-with-prompt [state side card prompt]): play a card, then click a prompt. This plays a card, then makes a call toclick-promptswith the given choice.(click-prompts [state side & prompts])Clicks the argument prompts, in order. They are all clicked from the given side, but you can instead pass in
{:side ... :choice ...}.Click-prompts intelligently examines the prompt state, to see if it's a card prompt, or a text/button prompt that's open, and chooses the correct subroutine for that (it defers to the click-card, click-prompt).
So, for example, to resolve ad blitz, you could call:
(click-prompts state :corp "2" "Launch Campaign" "New remote" "Pop-up Window" "Server 1")And to resolve dirty laundry on HQ, you could call:
(play-from-hand-with-prompt state :runner "Dirty Laundry" "HQ")I rewrote a couple of unit tests, just as a demo/proof of concept. I don't propose replacing everything with this, I just think it's a nice tool to have for later tests (ie for dawn cards).
As an example, the singular card that's been revealed so far is basically a bunch of stacked prompts, so it could have a very verbose set of unit tests: