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
2 changed files with 16 additions and 4 deletions
Showing only changes of commit 6fcb880b93 - Show all commits
@@ -2,8 +2,6 @@ package de.nowchess.io
import de.nowchess.api.game.GameContext
trait GameContextExport {
trait GameContextExport:
def exportGameContext(context: GameContext): String
}
@@ -131,3 +131,17 @@ class FenParserTest extends AnyFunSuite with Matchers:
board shouldBe empty
test("importGameContext: valid FEN string returns Right[GameContext]"):
val fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
val result = FenParser.importGameContext(fen)
result.isRight shouldBe true
result.fold(_ => fail("Expected Right"), ctx => ctx.turn shouldBe Color.White)
test("importGameContext: invalid FEN string returns Left[String] with error message"):
val invalidFen = "invalid fen string"
val result = FenParser.importGameContext(invalidFen)
result.isLeft shouldBe true
result.fold(msg => msg should include("Invalid FEN"), _ => fail("Expected Left"))