Skip to content

Commit 1257675

Browse files
Test Coverage Added
1 parent da7b583 commit 1257675

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.RpcReceiptRequest
6+
import io.github.hosseinkarami_dev.near.rpc.models.RpcReceiptResponse
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 ExperimentalReceiptTest {
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.experimentalReceipt(RpcReceiptRequest(
44+
receiptId = CryptoHash("3YbVEYmAkXyKZUk7iyKs4mVzvQ43azZnGjGj2hZua7VC")
45+
))
46+
val result = response.getResultOrNull<RpcReceiptResponse>()
47+
println("RPC Receipt Response: $response")
48+
assertTrue { true }
49+
}
50+
}

0 commit comments

Comments
 (0)