Skip to content

Commit 03b6424

Browse files
Test Coverage Added
1 parent a1f8556 commit 03b6424

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package io.github.hosseinkarami_dev.near.rpc.client
2+
3+
import io.github.hosseinkarami_dev.near.rpc.client.Utils.getResultOrNull
4+
import io.github.hosseinkarami_dev.near.rpc.models.CryptoHash
5+
import io.github.hosseinkarami_dev.near.rpc.models.RpcLightClientBlockProofRequest
6+
import io.github.hosseinkarami_dev.near.rpc.models.RpcLightClientNextBlockResponse
7+
import io.ktor.client.HttpClient
8+
import io.ktor.client.engine.cio.CIO
9+
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
10+
import io.ktor.serialization.kotlinx.json.json
11+
import kotlinx.coroutines.test.runTest
12+
import org.junit.jupiter.api.Test
13+
import kotlin.test.AfterTest
14+
import kotlin.test.BeforeTest
15+
import kotlin.test.assertTrue
16+
17+
class ExperimentalLightClientBlockProofTest {
18+
19+
private lateinit var httpClient: HttpClient
20+
private lateinit var nearClient: NearClient
21+
22+
@BeforeTest
23+
fun setup() {
24+
httpClient = HttpClient(CIO) {
25+
install(ContentNegotiation) {
26+
json()
27+
}
28+
}
29+
30+
nearClient = NearClient(
31+
httpClient = httpClient,
32+
baseUrl = "https://rpc.mainnet.near.org"
33+
)
34+
}
35+
36+
@AfterTest
37+
fun teardown() {
38+
httpClient.close()
39+
}
40+
41+
@Test
42+
fun testStatus() = runTest {
43+
val response = nearClient.experimentalLightClientBlockProof(
44+
RpcLightClientBlockProofRequest(
45+
blockHash = CryptoHash(""),
46+
lightClientHead = CryptoHash("")
47+
)
48+
)
49+
val result = response.getResultOrNull<RpcLightClientNextBlockResponse>()
50+
println("experimentalLightClientBlockProof Response: $response")
51+
assertTrue { response is RpcResponse.Failure }
52+
}
53+
}

0 commit comments

Comments
 (0)