File tree Expand file tree Collapse file tree 9 files changed +65
-0
lines changed
packages/tfchain_client/test Expand file tree Collapse file tree 9 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ void main() {
12
12
await queryClient.connect ();
13
13
});
14
14
15
+ tearDown (() async {
16
+ await queryClient.disconnect ();
17
+ });
18
+
15
19
test ('Test Get Balance' , () async {
16
20
String address = "5CJrCjZvsudNoJApTGG5PKcZfhAzAyGqgSK8bysoCV2oRBMC" ;
17
21
AccountInfo ? accountInfo =
@@ -43,6 +47,10 @@ void main() {
43
47
await client.connect ();
44
48
});
45
49
50
+ tearDown (() async {
51
+ await client.disconnect ();
52
+ });
53
+
46
54
test ('Test Transfer TFTs with invalid amount' , () async {
47
55
try {
48
56
await client.balances.transfer (
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ void main() {
21
21
await queryClient.connect ();
22
22
});
23
23
24
+ tearDown (() async {
25
+ await queryClient.disconnect ();
26
+ });
27
+
24
28
test ('Initialization' , () {
25
29
expect (queryClient.url, equals ("wss://tfchain.dev.grid.tf/ws" ));
26
30
expect (queryClient.contracts, isA <QueryContracts >());
@@ -56,6 +60,10 @@ void main() {
56
60
await client.connect ();
57
61
});
58
62
63
+ tearDown (() async {
64
+ await client.disconnect ();
65
+ });
66
+
59
67
test ('Initialization' , () {
60
68
expect (client.url, equals ("wss://tfchain.dev.grid.tf/ws" ));
61
69
expect (client.contracts, isA <Contracts >());
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ void main() {
13
13
await queryClient.connect ();
14
14
});
15
15
16
+ tearDown (() async {
17
+ await queryClient.disconnect ();
18
+ });
19
+
16
20
test ('Test Get Deleted Contract by Id' , () async {
17
21
Contract ? contract =
18
22
await queryClient.contracts.get (contractId: BigInt .from (97897 ));
@@ -107,6 +111,10 @@ void main() {
107
111
await client.connect ();
108
112
});
109
113
114
+ tearDown (() async {
115
+ await client.disconnect ();
116
+ });
117
+
110
118
test ('Test Create Node Contract with empty data' , () async {
111
119
try {
112
120
BigInt ? contractId = await client.contracts.createNode (
@@ -128,6 +136,7 @@ void main() {
128
136
test ('Test Create Name Contract then cancel it' , () async {
129
137
BigInt ? contractId = await client.contracts.createName (name: "xxx" );
130
138
expect (contractId, isNotNull);
139
+ await Future .delayed (Duration (seconds: 5 ));
131
140
try {
132
141
await client.contracts.cancel (contractId: contractId! );
133
142
} catch (error) {
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ void main() {
13
13
await queryClient.connect ();
14
14
});
15
15
16
+ tearDown (() async {
17
+ await queryClient.disconnect ();
18
+ });
19
+
16
20
test ('Test Get Farm by Id' , () async {
17
21
Farm ? farm = await queryClient.farms.get (id: 1 );
18
22
expect (farm, isNotNull);
@@ -38,6 +42,10 @@ void main() {
38
42
client = Client (link, mnemonic, type);
39
43
await client.connect ();
40
44
});
45
+
46
+ tearDown (() async {
47
+ await client.disconnect ();
48
+ });
41
49
42
50
test ('Test create farm' , () async {
43
51
final random = Random ();
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ void main() {
12
12
await queryClient.connect ();
13
13
});
14
14
15
+ tearDown (() async {
16
+ await queryClient.disconnect ();
17
+ });
18
+
15
19
test ('Test get Node by Id' , () async {
16
20
Node ? node = await queryClient.nodes.get (id: 11 );
17
21
expect (node, isNotNull);
@@ -38,6 +42,10 @@ void main() {
38
42
await client.connect ();
39
43
});
40
44
45
+ tearDown (() async {
46
+ await client.disconnect ();
47
+ });
48
+
41
49
test ('Test Set Power to node not owned by me' , () async {
42
50
try {
43
51
await client.nodes.setPower (nodeId: 72 , power: true );
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ void main() {
10
10
await queryClient.connect ();
11
11
});
12
12
13
+ tearDown (() async {
14
+ await queryClient.disconnect ();
15
+ });
16
+
13
17
test ('Test Get Pricing Policy' , () async {
14
18
PricingPolicy ? res = await queryClient.policies.get (id: 1 );
15
19
expect (res, isNotNull);
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ void main() {
11
11
await queryClient.connect ();
12
12
});
13
13
14
+ tearDown (() async {
15
+ await queryClient.disconnect ();
16
+ });
17
+
14
18
test ('Test Get Withdraw fee' , () async {
15
19
BigInt ? fee = await queryClient.bridge.getWithdrawFee ();
16
20
expect (fee, isNotNull);
@@ -34,6 +38,10 @@ void main() {
34
38
await client.connect ();
35
39
});
36
40
41
+ tearDown (() async {
42
+ await client.disconnect ();
43
+ });
44
+
37
45
test ('Test swap to stellar zero TFTs' , () async {
38
46
try {
39
47
await client.bridge.swapToStellar (
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ void main() {
9
9
await queryClient.connect ();
10
10
});
11
11
12
+ tearDown (() async {
13
+ await queryClient.disconnect ();
14
+ });
15
+
12
16
test ('Test Get TFT price' , () async {
13
17
final price = await queryClient.price.get ();
14
18
expect (price, isNotNull);
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ void main() {
12
12
await queryClient.connect ();
13
13
});
14
14
15
+ tearDown (() async {
16
+ await queryClient.disconnect ();
17
+ });
18
+
15
19
test ('Test Get Twin with id' , () async {
16
20
int id = 214 ;
17
21
final twin = await queryClient.twins.get (id: id);
@@ -44,6 +48,10 @@ void main() {
44
48
await client.connect ();
45
49
});
46
50
51
+ tearDown (() async {
52
+ await client.disconnect ();
53
+ });
54
+
47
55
test ('Test Create Twin' , () async {
48
56
try {
49
57
int ? twin = await client.twins.create (relay: [], pk: []);
You can’t perform that action at this time.
0 commit comments