refactor: NCS-22 NCS-23 reworked modules and tests #17
@@ -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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user