refactor(tests): improve CommandInvoker tests for clarity and coverage
Build & Test (NowChessSystems) TeamCity build failed

This commit is contained in:
2026-04-05 22:44:53 +02:00
parent 03c3b90d06
commit d2c22337aa
14 changed files with 358 additions and 712 deletions
@@ -6,11 +6,24 @@ import org.scalatest.matchers.should.Matchers
class RendererAndUnicodeTest extends AnyFunSuite with Matchers:
test("unicode mapping covers representative white and black pieces"):
Piece(Color.White, PieceType.King).unicode shouldBe "\u2654"
Piece(Color.White, PieceType.Queen).unicode shouldBe "\u2655"
Piece(Color.Black, PieceType.King).unicode shouldBe "\u265A"
Piece(Color.Black, PieceType.Pawn).unicode shouldBe "\u265F"
test("unicode returns correct unicode character for all piece types"):
val pieces = Seq(
(Piece(Color.White, PieceType.King), "\u2654"),
(Piece(Color.White, PieceType.Queen), "\u2655"),
(Piece(Color.White, PieceType.Rook), "\u2656"),
(Piece(Color.White, PieceType.Bishop), "\u2657"),
(Piece(Color.White, PieceType.Knight), "\u2658"),
(Piece(Color.White, PieceType.Pawn), "\u2659"),
(Piece(Color.Black, PieceType.King), "\u265A"),
(Piece(Color.Black, PieceType.Queen), "\u265B"),
(Piece(Color.Black, PieceType.Rook), "\u265C"),
(Piece(Color.Black, PieceType.Bishop), "\u265D"),
(Piece(Color.Black, PieceType.Knight), "\u265E"),
(Piece(Color.Black, PieceType.Pawn), "\u265F")
)
pieces.foreach { (piece, expected) =>
piece.unicode shouldBe expected
}
test("render outputs coordinates ranks ansi escapes and piece glyphs"):
val board = Board(Map(Square(File.E, Rank.R4) -> Piece(Color.White, PieceType.Queen)))
@@ -24,4 +37,10 @@ class RendererAndUnicodeTest extends AnyFunSuite with Matchers:
Renderer.render(board) should include("\u2655")
Renderer.render(board) should include("\u001b[")
test("render applies black piece color for black pieces"):
val board = Board(Map(Square(File.A, Rank.R1) -> Piece(Color.Black, PieceType.King)))
val rendered = Renderer.render(board)
rendered should include("\u265A") // Black king unicode
rendered should include("\u001b[30m") // ANSI black text color