Skip to content

Commit

Permalink
test(acceptance): dog wolf acceptance tests (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Aug 17, 2023
1 parent 73801b4 commit 8163c39
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
29 changes: 29 additions & 0 deletions tests/acceptance/features/game/features/role/dog-wolf.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: 馃惗 Dog Wolf role

Scenario: 馃惗 Dog Wolf chooses the villagers side

When a created game with options described in file no-sheriff-option.json and with the following players
| name | role |
| Antoine | dog-wolf |
| Benoit | villager |
| Cecile | villager |
| David | werewolf |
Then the game's current play should be dog-wolf to choose-side
And the player named Antoine should be on villagers current side and originally be on villagers side

When the dog wolf chooses the villagers side
Then the player named Antoine should be on villagers current side and originally be on villagers side

Scenario: 馃惗 Dog Wolf chooses the werewolves side

When a created game with options described in file no-sheriff-option.json and with the following players
| name | role |
| Antoine | dog-wolf |
| Benoit | villager |
| Cecile | villager |
| David | werewolf |
Then the game's current play should be dog-wolf to choose-side
And the player named Antoine should be on villagers current side and originally be on villagers side

When the dog wolf chooses the werewolves side
Then the player named Antoine should be on werewolves current side and originally be on villagers side
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Feature: 馃悞 Wild Child role
And the game's current play should be all to vote

When all vote with the following votes
| voter | target |
| Maxime | Olivia |
| 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 @@ -4,6 +4,7 @@ import type { MakeGamePlayDto } from "../../../../../src/modules/game/dto/make-g
import type { WITCH_POTIONS } from "../../../../../src/modules/game/enums/game-play.enum";
import { getPlayerWithNameOrThrow } from "../../../../../src/modules/game/helpers/game.helper";
import type { Game } from "../../../../../src/modules/game/schemas/game.schema";
import type { ROLE_SIDES } from "../../../../../src/modules/role/enums/role.enum";
import type { CustomWorld } from "../../../shared/types/world.types";
import { convertDatatableToMakeGameplayVotes, convertDatatableToPlayers } from "../helpers/game-datatable.helper";
import { makeGamePlayRequest } from "../helpers/game-request.helper";
Expand Down Expand Up @@ -148,6 +149,13 @@ When(/^the wild child chooses the player named (?<name>.+) as a model$/u, async
this.game = this.response.json<Game>();
});

When(/^the dog wolf chooses the (?<chosenSide>villagers|werewolves) side$/u, async function(this: CustomWorld, chosenSide: ROLE_SIDES): Promise<void> {
const makeGamePlayDto: MakeGamePlayDto = { chosenSide };

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 8163c39

Please sign in to comment.