Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed tests #2046

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2704,7 +2704,7 @@ paths:
$ref: '#/components/schemas/ApiError'

/blocks/headerIds:
get:
post:
summary: Get the list of full block info by given header ids
operationId: getFullBlockByIds
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import akka.http.scaladsl.model.{ContentTypes, HttpEntity, StatusCodes, Universa
import akka.http.scaladsl.server.Route
import akka.http.scaladsl.testkit.ScalatestRouteTest
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport
import io.circe.Json
import io.circe.syntax._
import org.ergoplatform.http.api.BlocksApiRoute
import org.ergoplatform.modifiers.ErgoFullBlock
Expand Down Expand Up @@ -34,8 +35,7 @@ class BlocksApiRouteSpec
history
.headerIdsAt(0, 50)
.map(Algos.encode)
.asJson
.toString() shouldEqual responseAs[String]
.asJson shouldEqual responseAs[Json]
}
}

Expand All @@ -56,8 +56,7 @@ class BlocksApiRouteSpec
.lastHeaders(1)
.headers
.map(_.asJson)
.asJson
.toString() shouldEqual responseAs[String]
.asJson shouldEqual responseAs[Json]
}
}

Expand All @@ -67,19 +66,18 @@ class BlocksApiRouteSpec
history
.headerIdsAtHeight(0)
.map(Algos.encode)
.asJson
.toString() shouldEqual responseAs[String]
.asJson shouldEqual responseAs[Json]
}
}

it should "get chain slice" in {
Get(prefix + "/chainSlice?fromHeight=0") ~> route ~> check {
status shouldBe StatusCodes.OK
chain.map(_.header).asJson.toString() shouldEqual responseAs[String]
chain.map(_.header).asJson shouldEqual responseAs[Json]
}
Get(prefix + "/chainSlice?fromHeight=2&toHeight=4") ~> route ~> check {
status shouldBe StatusCodes.OK
chain.slice(2, 4).map(_.header).asJson.toString() shouldEqual responseAs[String]
chain.slice(2, 4).map(_.header).asJson shouldEqual responseAs[Json]
}
}

Expand All @@ -91,8 +89,8 @@ class BlocksApiRouteSpec
.flatMap(history.getFullBlock)
.map(_.asJson)
.get
.toString
responseAs[String] shouldEqual expected

responseAs[Json] shouldEqual expected
}
}

Expand Down Expand Up @@ -121,8 +119,8 @@ class BlocksApiRouteSpec
.flatMap(history.getFullBlock)
.map(_.header.asJson)
.get
.toString
responseAs[String] shouldEqual expected

responseAs[Json] shouldEqual expected
}
}

Expand All @@ -131,8 +129,8 @@ class BlocksApiRouteSpec
status shouldBe StatusCodes.OK
val header = history.typedModifierById[Header](headerIdBytes).value
val fullBlock = history.getFullBlock(header).value
val expected = fullBlock.blockTransactions.asJson.toString
responseAs[String] shouldEqual expected
val expected = fullBlock.blockTransactions.asJson
responseAs[Json] shouldEqual expected
}
}

Expand Down