test: add tests for undo and redo notifications in GameEngine
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
This commit is contained in:
@@ -166,4 +166,24 @@ class TerminalUITest extends AnyFunSuite with Matchers {
|
||||
|
||||
out.toString should include("Captured: Knight(White) on A8") // Depending on how piece/coord serialize
|
||||
}
|
||||
|
||||
test("TerminalUI processes valid move input via processUserInput") {
|
||||
val in = new ByteArrayInputStream("e2e4\nq\n".getBytes)
|
||||
val out = new ByteArrayOutputStream()
|
||||
|
||||
val engine = new GameEngine()
|
||||
val ui = new TerminalUI(engine)
|
||||
|
||||
Console.withIn(in) {
|
||||
Console.withOut(out) {
|
||||
ui.start()
|
||||
}
|
||||
}
|
||||
|
||||
val output = out.toString
|
||||
output should include("White's turn.")
|
||||
output should include("Game over. Goodbye!")
|
||||
// The move should have been processed and the board displayed
|
||||
engine.turn shouldBe Color.Black
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user