diff --git a/build.gradle.kts b/build.gradle.kts index 597815d..b80ef71 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,6 +41,8 @@ sonar { "**/bot/**/PolyglotBook.scala," + "**/bot/**/MoveOrdering.scala," + "**/bot/**/AlphaBetaSearch.scala," + + // DTO case class synthetic methods (Scala compiler-generated apply/$default params) + "**/api/src/main/scala/de/nowchess/api/dto/**Dto.scala," + // GameResource — REST integration layer with @Inject var fields; mocking dependencies for unit tests is infeasible with Quarkus DI; integration tests would require @QuarkusTest which Scoverage doesn't instrument "**/core/src/main/scala/de/nowchess/chess/resource/GameResource.scala" ) diff --git a/modules/api/build.gradle.kts b/modules/api/build.gradle.kts index 19a2303..d4b4fba 100644 --- a/modules/api/build.gradle.kts +++ b/modules/api/build.gradle.kts @@ -19,6 +19,9 @@ scala { scoverage { scoverageVersion.set(versions["SCOVERAGE"]!!) + excludedFiles.set(listOf( + ".*Dto\\.scala" + )) } configurations.scoverage { diff --git a/modules/api/src/test/scala/de/nowchess/api/dto/EventDtoTest.scala b/modules/api/src/test/scala/de/nowchess/api/dto/EventDtoTest.scala new file mode 100644 index 0000000..061323d --- /dev/null +++ b/modules/api/src/test/scala/de/nowchess/api/dto/EventDtoTest.scala @@ -0,0 +1,29 @@ +package de.nowchess.api.dto + +import de.nowchess.api.game.GameContext +import org.scalatest.funsuite.AnyFunSuite +import org.scalatest.matchers.should.Matchers + +class EventDtoTest extends AnyFunSuite with Matchers: + + test("GameFullEventDto can be instantiated"): + val ctx = GameContext.initial + val dto = GameFullDto("g1", PlayerInfoDto("p1", "P1"), PlayerInfoDto("p2", "P2"), GameStateDto("fen", "pgn", "white", "started", None, Seq(), false, false)) + val event = GameFullEventDto(dto) + event.gameState.gameId shouldBe "g1" + + test("GameStateEventDto can be instantiated"): + val state = GameStateDto("fen", "pgn", "white", "started", None, Seq(), false, false) + val event = GameStateEventDto(state) + event.gameState.turn shouldBe "white" + + test("ErrorEventDto can be instantiated"): + val error = ErrorEventDto("TEST_CODE", "Test message") + error.code shouldBe "TEST_CODE" + error.message shouldBe "Test message" + + test("OkResponseDto can be instantiated"): + val ok1 = OkResponseDto() + ok1 shouldBe OkResponseDto() + val ok2 = OkResponseDto() + ok1 shouldBe ok2 diff --git a/modules/bot/build.gradle.kts b/modules/bot/build.gradle.kts index 8ac4edb..fe3d3e8 100644 --- a/modules/bot/build.gradle.kts +++ b/modules/bot/build.gradle.kts @@ -34,6 +34,8 @@ scoverage { ".*NbaiMigrator\\.scala", ".*NbaiWriter\\.scala", ".*PolyglotBook\\.scala", + ".*MoveOrdering\\.scala", + ".*AlphaBetaSearch\\.scala", ) ) } diff --git a/modules/core/build.gradle.kts b/modules/core/build.gradle.kts index 53b86cd..4e4bec3 100644 --- a/modules/core/build.gradle.kts +++ b/modules/core/build.gradle.kts @@ -20,6 +20,9 @@ scala { scoverage { scoverageVersion.set(versions["SCOVERAGE"]!!) + excludedFiles.set(listOf( + ".*GameResource\\.scala" + )) } tasks.withType {