test: add tests for undo and redo notifications in GameEngine
Build & Test (NowChessSystems) TeamCity build finished

This commit is contained in:
2026-03-31 09:34:39 +02:00
parent 5fab97ec10
commit 9f0e2b0a14
3 changed files with 62 additions and 14 deletions
@@ -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
}
}