-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
import type { PieceSlot } from "./piece-slot"; | ||
|
||
interface shopBuy { | ||
productId: string; | ||
} | ||
|
||
export interface Interaction { | ||
grabPiece?: PieceSlot; | ||
ungrabPiece?: PieceSlot; | ||
shopBuy?: shopBuy; | ||
shopBuy?: number; | ||
reroll?: true; | ||
levelUp?: true; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test } from "vitest"; | ||
import { cast } from "./cast"; | ||
import { withTwoPlayerGameStarted } from "../fixtures/with-two-player-game-started"; | ||
import { firstValueFrom, map, filter } from "rxjs"; | ||
import { observeGame } from "../api/observe-game"; | ||
|
||
test("cast a reroll", async () => { | ||
const testContext = await withTwoPlayerGameStarted(); | ||
|
||
const frontContext = testContext.frontContexts[0]; | ||
|
||
if (!frontContext) { | ||
throw new Error(`Player ${0} not found !`); | ||
} | ||
|
||
const moneyBefore = await firstValueFrom( | ||
observeGame(frontContext).pipe( | ||
map(({ game }) => game.playerMoney[frontContext.publicKey]), | ||
), | ||
); | ||
|
||
await cast(frontContext, { reroll: true }); | ||
|
||
await firstValueFrom( | ||
observeGame(frontContext).pipe( | ||
map(({ game }) => game.playerMoney[frontContext.publicKey]), | ||
filter((money) => money !== moneyBefore), | ||
), | ||
); | ||
}); |
This file contains 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
This file contains 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