@@ -6,11 +6,23 @@ void main() {
66 late Wallet wallet;
77 late String dbPath;
88
9+ final String mintUrl =
10+ Platform .environment['CDK_DART_TEST_MINT_URL' ] ??
11+ 'https://dummy-mint-url-for-local-testing.invalid' ;
12+ final bool runLiveMintTests =
13+ Platform .environment.containsKey ('CDK_DART_TEST_MINT_URL' ) &&
14+ Platform .environment['CDK_DART_TEST_MINT_URL' ]! .isNotEmpty;
15+ final int settlementDelaySeconds =
16+ int .tryParse (
17+ Platform .environment['CDK_DART_MINT_SETTLEMENT_DELAY_SECONDS' ] ?? '' ,
18+ ) ??
19+ 3 ;
20+
921 setUp (() {
1022 final tempDir = Directory .systemTemp;
1123 dbPath = '${tempDir .path }/${DateTime .now ().microsecondsSinceEpoch }.sqlite' ;
1224 wallet = Wallet (
13- mintUrl: 'https://testnut.cashudevkit.org' ,
25+ mintUrl: mintUrl ,
1426 unit: SatCurrencyUnit (),
1527 mnemonic: generateMnemonic (),
1628 store: SqliteWalletStore (dbPath),
@@ -32,7 +44,7 @@ void main() {
3244
3345 test ('in-memory sqlite handles concurrent access' , () async {
3446 final memoryWallet = Wallet (
35- mintUrl: 'https://testnut.cashudevkit.org' ,
47+ mintUrl: mintUrl ,
3648 unit: SatCurrencyUnit (),
3749 mnemonic: generateMnemonic (),
3850 store: SqliteWalletStore (':memory:' ),
@@ -52,29 +64,35 @@ void main() {
5264 }
5365 });
5466
55- test ('mint flow' , () async {
56- final quote = await wallet.mintQuote (
57- paymentMethod: Bolt11PaymentMethod (),
58- amount: Amount (value: 100 ),
59- description: null ,
60- extra: null ,
61- );
67+ test (
68+ 'mint flow' ,
69+ () async {
70+ final quote = await wallet.mintQuote (
71+ paymentMethod: Bolt11PaymentMethod (),
72+ amount: Amount (value: 100 ),
73+ description: null ,
74+ extra: null ,
75+ );
6276
63- expect (quote.id, isNotEmpty);
64- expect (quote.request, isNotEmpty);
77+ expect (quote.id, isNotEmpty);
78+ expect (quote.request, isNotEmpty);
6579
66- // testnut pays quotes automatically, wait briefly for payment to settle
67- await Future .delayed (Duration (seconds: 3 ));
80+ // testnut pays quotes automatically, wait briefly for payment to settle
81+ await Future .delayed (Duration (seconds: settlementDelaySeconds ));
6882
69- final proofs = await wallet.mint (
70- quoteId: quote.id,
71- amountSplitTarget: NoneSplitTarget (),
72- spendingConditions: null ,
73- );
83+ final proofs = await wallet.mint (
84+ quoteId: quote.id,
85+ amountSplitTarget: NoneSplitTarget (),
86+ spendingConditions: null ,
87+ );
7488
75- expect (proofs, isNotEmpty);
89+ expect (proofs, isNotEmpty);
7690
77- final balance = await wallet.totalBalance ();
78- expect (balance.value, equals (100 ));
79- });
91+ final balance = await wallet.totalBalance ();
92+ expect (balance.value, equals (100 ));
93+ },
94+ skip: ! runLiveMintTests
95+ ? 'Set CDK_DART_TEST_MINT_URL to run live mint integration tests'
96+ : false ,
97+ );
8098}
0 commit comments