Skip to content

Commit 1d440d3

Browse files
test: reproduce empty payload issue
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent 2a45813 commit 1d440d3

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

test/cln_client_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void main() {
156156
};
157157
var boltString = await unixCient.simpleCall("invoice", params: params);
158158
try {
159-
var response = await client.call<PayProxy, PayResponse>(
159+
var _ = await client.call<PayProxy, PayResponse>(
160160
method: "pay",
161161
params: PayProxy.build(invoice: boltString["bolt11"]));
162162
await client.close();

test/cln_grpc_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import 'dart:io';
22

3+
import 'package:cln_common/cln_common.dart';
34
import 'package:cln_grpc/cln_grpc.dart';
45
import 'package:test/test.dart';
56

7+
import 'model/model.dart';
8+
69
void main() {
710
var env = Platform.environment;
811
var tlsPath = env['TLS_PATH']!;
@@ -14,5 +17,19 @@ void main() {
1417
expect(response.alias, "clighting4j-node");
1518
await client.close();
1619
});
20+
21+
test('API List Funds with decode function', () async {
22+
var client = GRPCClient(rootPath: tlsPath);
23+
var response =
24+
await client.call<CLNListFundsRequest, Map<String, dynamic>>(
25+
method: "listfunds",
26+
params: CLNListFundsRequest.build(),
27+
onDecode: (jsonResponse) {
28+
LogManager.getInstance
29+
.debug("Grpc list funds call returns: $jsonResponse");
30+
return jsonResponse as Map<String, dynamic>;
31+
});
32+
expect(response.isNotEmpty, isTrue);
33+
});
1734
});
1835
}

test/model/model.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'package:cln_common/cln_common.dart';
2+
import 'package:cln_grpc/cln_grpc.dart';
3+
4+
class CLNListFundsRequest extends Serializable {
5+
ListfundsRequest proxy;
6+
7+
CLNListFundsRequest(this.proxy);
8+
9+
factory CLNListFundsRequest.build() =>
10+
CLNListFundsRequest(ListfundsRequest());
11+
12+
@override
13+
Map<String, dynamic> toJSON() => proxy.toProto3Json() as Map<String, dynamic>;
14+
15+
@override
16+
T as<T>() => proxy as T;
17+
}

0 commit comments

Comments
 (0)