File tree Expand file tree Collapse file tree 4 files changed +24
-14
lines changed
coin-modules/coin-polkadot/src Expand file tree Collapse file tree 4 files changed +24
-14
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @ledgerhq/coin-polkadot " : minor
3
+ " @ledgerhq/live-common " : minor
4
+ ---
5
+
6
+ Fix Polkadot integration tests
Original file line number Diff line number Diff line change @@ -73,18 +73,21 @@ const getSendTransactionStatus: AccountBridge<
73
73
errors . amount = new AmountRequired ( ) ;
74
74
}
75
75
76
- if ( ! errors . amount && ! transaction . useAllAmount && account . spendableBalance . isZero ( ) ) {
77
- errors . amount = new NotEnoughBalance ( ) ;
78
- } else if ( totalSpent . gt ( account . spendableBalance ) ) {
79
- errors . amount = new NotEnoughBalance ( ) ;
80
- }
76
+ if ( ! ( errors . amount instanceof AmountRequired ) ) {
77
+ if (
78
+ ( ! transaction . useAllAmount && account . spendableBalance . isZero ( ) ) ||
79
+ totalSpent . gt ( account . spendableBalance )
80
+ ) {
81
+ errors . amount = new NotEnoughBalance ( ) ;
82
+ }
81
83
82
- if (
83
- ! errors . amount &&
84
- account . polkadotResources ?. lockedBalance . gt ( 0 ) &&
85
- ( transaction . useAllAmount || account . spendableBalance . minus ( totalSpent ) . lt ( FEES_SAFETY_BUFFER ) )
86
- ) {
87
- warnings . amount = new PolkadotAllFundsWarning ( ) ;
84
+ if (
85
+ account . polkadotResources ?. lockedBalance . gt ( 0 ) &&
86
+ ( transaction . useAllAmount ||
87
+ account . spendableBalance . minus ( totalSpent ) . lt ( FEES_SAFETY_BUFFER ) )
88
+ ) {
89
+ warnings . amount = new PolkadotAllFundsWarning ( ) ;
90
+ }
88
91
}
89
92
90
93
if (
@@ -299,7 +302,7 @@ export const getTransactionStatus: AccountBridge<
299
302
errors . amount = new NotEnoughBalance ( ) ;
300
303
}
301
304
302
- if ( totalSpent . gt ( account . spendableBalance ) ) {
305
+ if ( ! ( errors . amount instanceof AmountRequired ) && totalSpent . gt ( account . spendableBalance ) ) {
303
306
errors . amount = new NotEnoughBalance ( ) ;
304
307
}
305
308
Original file line number Diff line number Diff line change @@ -380,12 +380,12 @@ const polkadot: CurrenciesData<Transaction> = {
380
380
mode : "send" ,
381
381
recipient : ACCOUNT_SAME_STASHCONTROLLER ,
382
382
} ) ,
383
- expectedStatus : account => ( {
383
+ expectedStatus : ( _account , _transaction , status ) => ( {
384
384
errors : { } ,
385
385
warnings : {
386
386
amount : new PolkadotAllFundsWarning ( ) ,
387
387
} ,
388
- totalSpent : account . spendableBalance ,
388
+ totalSpent : status . estimatedFees ,
389
389
} ) ,
390
390
} ,
391
391
{
Original file line number Diff line number Diff line change 76
76
"test" : " pnpm ci-test-unit" ,
77
77
"ci-test-unit" : " env-cmd -f .ci.unit.env pnpm jest --ci --updateSnapshot && git diff --exit-code src" ,
78
78
"ci-test-integration" : " env-cmd -f .ci.integration.env pnpm jest --ci --updateSnapshot --passWithNoTests" ,
79
+ "ci-test-integration:debug" : " env-cmd -f .ci.integration.env node --inspect-wait ./node_modules/jest/bin/jest.js --runInBand --ci --updateSnapshot --passWithNoTests" ,
79
80
"test-bridge" : " env-cmd -f .ci.bridge.env pnpm jest --ci --updateSnapshot --passWithNoTests --runInBand" ,
80
81
"test-bridge-update" : " UPDATE_BACKEND_MOCKS=1 env-cmd -f .ci.integration.env pnpm jest --ci --updateSnapshot --passWithNoTests" ,
81
82
"test-account-migration" : " tsx src/__tests__/migration/account-migration.ts" ,
You can’t perform that action at this time.
0 commit comments