Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(acceptance): dog wolf acceptance tests #410

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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