Skip to content

Instantly share code, notes, and snippets.

@monkey-codes
Created June 9, 2023 23:26
Show Gist options
  • Select an option

  • Save monkey-codes/d57d9a7143a17f4f8d0cff497587b270 to your computer and use it in GitHub Desktop.

Select an option

Save monkey-codes/d57d9a7143a17f4f8d0cff497587b270 to your computer and use it in GitHub Desktop.
Testing a pure function
"should detect won games" {
winningMoves
.map { games ->
checkAll(games) { moves ->
either {
val game = Game.new().bind().make(moves).bind()
moves.forEach { (coordinates, symbol) -> game.cell(coordinates) shouldBe symbol }
val won = game.shouldBeTypeOf<Won>()
won.winner shouldBe CROSS
}
.shouldBeRight()
}
}
.shouldBeRight()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment