refactor: NCS-22 NCS-23 reworked modules and tests #17

Merged
Janis merged 42 commits from refactor/NCS-22 into main 2026-04-06 09:07:40 +02:00
Showing only changes of commit 8b5303fdab - Show all commits
@@ -1,8 +1,9 @@
package de.nowchess.io.pgn
import de.nowchess.api.board.{PieceType, *}
import de.nowchess.api.move.PromotionPiece
import de.nowchess.api.game.{GameHistory, HistoryMove}
import de.nowchess.api.move.{PromotionPiece, Move, MoveType}
import de.nowchess.api.game.{GameHistory, HistoryMove, GameContext}
import de.nowchess.io.pgn.PgnParser
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
@@ -113,3 +114,23 @@ class PgnExporterTest extends AnyFunSuite with Matchers:
val pgn = PgnExporter.exportGame(Map.empty, history)
pgn shouldBe "1. e4 *"
test("exportGameContext: moves are preserved in output") {
val moves = List(
Move(Square(File.E, Rank.R2), Square(File.E, Rank.R4), MoveType.Normal),
Move(Square(File.E, Rank.R7), Square(File.E, Rank.R5), MoveType.Normal)
)
val ctx = GameContext.initial.copy(moves = moves)
val exported = PgnExporter.exportGameContext(ctx)
exported.contains("e4") shouldBe true
exported.contains("e5") shouldBe true
}
test("exportGameContext: empty game returns headers only") {
val ctx = GameContext.initial
val exported = PgnExporter.exportGameContext(ctx)
exported.contains("[Event") shouldBe true
exported.contains("*") shouldBe true // Result terminator
}