Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salamonpavel committed May 22, 2024
1 parent 461f917 commit 45adbfc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import za.co.absa.atum.server.api.TestData
import za.co.absa.atum.server.api.controller.CheckpointController
import za.co.absa.atum.server.model.ErrorResponse.{GeneralErrorResponse, InternalServerErrorResponse}
import za.co.absa.atum.server.model.PlayJsonImplicits.{readsCheckpointDTO, writesCheckpointDTO}
import za.co.absa.atum.server.model.SuccessResponse.SingleSuccessResponse
import za.co.absa.atum.server.model.SuccessResponse.{SingleSuccessResponse, mapToSingleSingleSuccessResponse}
import zio._
import zio.test.Assertion.equalTo
import zio.test._
Expand All @@ -47,7 +47,9 @@ object CreateCheckpointEndpointSpec extends ZIOSpecDefault with Endpoints with T
private val checkpointControllerMockLayer = ZLayer.succeed(checkpointControllerMock)

private val createCheckpointServerEndpoint =
createCheckpointEndpoint.zServerLogic(CheckpointController.createCheckpoint)
createCheckpointEndpoint.zServerLogic(
CheckpointController.createCheckpoint _ andThen(_.map(SingleSuccessResponse(_)))
)

def spec: Spec[TestEnvironment with Scope, Any] = {
val backendStub = TapirStubInterpreter(SttpBackendStub.apply(new RIOMonadError[CheckpointController]))
Expand All @@ -68,7 +70,7 @@ object CreateCheckpointEndpointSpec extends ZIOSpecDefault with Endpoints with T
val body = response.map(_.body)
val statusCode = response.map(_.code)

assertZIO(body <&> statusCode)(equalTo(Right(checkpointDTO1), StatusCode.Created))
assertZIO(body <&> statusCode)(equalTo(Right(SingleSuccessResponse(checkpointDTO1)), StatusCode.Created))
},
test("Returns expected BadRequest") {
val response = request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ object CreatePartitioningEndpointSpec extends ZIOSpecDefault with Endpoints with
private val createPartitioningEndpointMockLayer = ZLayer.succeed(createPartitioningEndpointMock)

private val createPartitioningServerEndpoint =
createPartitioningEndpoint.zServerLogic(PartitioningController.createPartitioningIfNotExists)
createPartitioningEndpoint.zServerLogic(
PartitioningController.createPartitioningIfNotExists _ andThen (_.map(SingleSuccessResponse(_)))
)

def spec: Spec[TestEnvironment with Scope, Any] = {
val backendStub = TapirStubInterpreter(SttpBackendStub.apply(new RIOMonadError[PartitioningController]))
Expand Down

0 comments on commit 45adbfc

Please sign in to comment.