|
1 |
| -import { expect, it } from "bun:test"; |
| 1 | +import { describe, expect, it } from "bun:test"; |
2 | 2 | import { testClient } from "hono/testing";
|
3 | 3 | import { klesiaRpcRoute } from "./";
|
4 | 4 |
|
5 |
| -const client = testClient(klesiaRpcRoute); |
| 5 | +const request = testClient(klesiaRpcRoute).api.$post; |
6 | 6 |
|
7 |
| -it("returns result for mina_getTransactionCount", async () => { |
8 |
| - const response = await client.api.$post({ |
9 |
| - json: { |
10 |
| - method: "mina_getTransactionCount", |
11 |
| - params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
12 |
| - }, |
| 7 | +describe("Mina Devnet RPC", () => { |
| 8 | + it("returns result for mina_getTransactionCount", async () => { |
| 9 | + const response = await request({ |
| 10 | + json: { |
| 11 | + method: "mina_getTransactionCount", |
| 12 | + params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
| 13 | + }, |
| 14 | + }); |
| 15 | + const { result } = (await response.json()) as { result: string }; |
| 16 | + expect(BigInt(result)).toBeGreaterThan(0); |
13 | 17 | });
|
14 |
| - const { result } = (await response.json()) as { result: string }; |
15 |
| - expect(BigInt(result)).toBeGreaterThan(0); |
16 |
| -}); |
17 | 18 |
|
18 |
| -it("returns result for mina_getBalance", async () => { |
19 |
| - const response = await client.api.$post({ |
20 |
| - json: { |
21 |
| - method: "mina_getBalance", |
22 |
| - params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
23 |
| - }, |
| 19 | + it("returns result for mina_getBalance", async () => { |
| 20 | + const response = await request({ |
| 21 | + json: { |
| 22 | + method: "mina_getBalance", |
| 23 | + params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
| 24 | + }, |
| 25 | + }); |
| 26 | + const { result } = (await response.json()) as { result: string }; |
| 27 | + expect(BigInt(String(result))).toBeGreaterThan(0); |
24 | 28 | });
|
25 |
| - const { result } = (await response.json()) as { result: string }; |
26 |
| - expect(BigInt(String(result))).toBeGreaterThan(0); |
27 |
| -}); |
28 | 29 |
|
29 |
| -it("returns result for mina_blockHash", async () => { |
30 |
| - const response = await client.api.$post({ |
31 |
| - json: { method: "mina_blockHash" }, |
| 30 | + it("returns result for mina_blockHash", async () => { |
| 31 | + const response = await request({ |
| 32 | + json: { method: "mina_blockHash" }, |
| 33 | + }); |
| 34 | + const { result } = (await response.json()) as { result: string }; |
| 35 | + expect(result.length).toBeGreaterThan(0); |
32 | 36 | });
|
33 |
| - const { result } = (await response.json()) as { result: string }; |
34 |
| - expect(result.length).toBeGreaterThan(0); |
35 |
| -}); |
36 | 37 |
|
37 |
| -it("returns result for mina_chainId", async () => { |
38 |
| - const response = await client.api.$post({ |
39 |
| - json: { method: "mina_chainId" }, |
| 38 | + it("returns result for mina_chainId", async () => { |
| 39 | + const response = await request({ |
| 40 | + json: { method: "mina_chainId" }, |
| 41 | + }); |
| 42 | + const { result } = (await response.json()) as { result: string }; |
| 43 | + expect(result.length).toBeGreaterThan(0); |
40 | 44 | });
|
41 |
| - const { result } = (await response.json()) as { result: string }; |
42 |
| - expect(result.length).toBeGreaterThan(0); |
43 |
| -}); |
44 | 45 |
|
45 |
| -it("returns result for mina_getAccount", async () => { |
46 |
| - const response = await client.api.$post({ |
47 |
| - json: { |
48 |
| - method: "mina_getAccount", |
49 |
| - params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
50 |
| - }, |
| 46 | + it("returns result for mina_getAccount", async () => { |
| 47 | + const response = await request({ |
| 48 | + json: { |
| 49 | + method: "mina_getAccount", |
| 50 | + params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], |
| 51 | + }, |
| 52 | + }); |
| 53 | + // biome-ignore lint/suspicious/noExplicitAny: TODO |
| 54 | + const { result } = (await response.json()) as any; |
| 55 | + expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0); |
| 56 | + expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0); |
51 | 57 | });
|
52 |
| - // biome-ignore lint/suspicious/noExplicitAny: TODO |
53 |
| - const { result } = (await response.json()) as any; |
54 |
| - expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0); |
55 |
| - expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0); |
56 | 58 | });
|
0 commit comments