Skip to content

Commit

Permalink
test(acceptance): wild child acceptance tests (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Aug 17, 2023
1 parent 4b5cb79 commit 73801b4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/acceptance/features/game/features/role/wild-child.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Feature: 馃悞 Wild Child role

Scenario: 馃悞 Wild Child changes his side when his model dies

When a created game with options described in file no-sheriff-option.json and with the following players
| name | role |
| Antoine | wild-child |
| Olivia | werewolf |
| JB | villager |
| Maxime | villager |
Then the game's current play should be wild-child to choose-model
And the player named Antoine should be on villagers current side and originally be on villagers side

When the wild child chooses the player named Olivia as a model
Then the player named Olivia should have the worshiped from wild-child attribute
And the game's current play should be werewolves to eat

When the werewolves eat the player named JB
Then the player named JB should be murdered by werewolves from eaten
And the game's current play should be all to vote

When all vote with the following votes
| voter | target |
| Maxime | Olivia |
Then the player named Olivia should be murdered by all from vote
And the player named Antoine should be on werewolves current side and originally be on villagers side
And the game's current play should be werewolves to eat
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ When(/^the fox sniffs the player named (?<name>.+)$/u, async function(this: Cust
this.game = this.response.json<Game>();
});

When(/^the wild child chooses the player named (?<name>.+) as a model$/u, async function(this: CustomWorld, targetName: string): Promise<void> {
const target = getPlayerWithNameOrThrow(targetName, this.game, new Error("Player name not found"));
const makeGamePlayDto: MakeGamePlayDto = { targets: [{ playerId: target._id }] };

this.response = await makeGamePlayRequest(makeGamePlayDto, this.game, this.app);
this.game = this.response.json<Game>();
});

When(/^the player or group skips his turn$/u, async function(this: CustomWorld): Promise<void> {
this.response = await makeGamePlayRequest({}, this.game, this.app);
this.game = this.response.json<Game>();
Expand Down

0 comments on commit 73801b4

Please sign in to comment.