added util fns - play-from-hand-with-prompt, click-prompts #7942
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-prompts
with 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: