Skip to content

Commit d411c04

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): refactor conditional logic in parse transaction tests
Refactored the conditional structure in parsePsbt test file to improve readability by using an early return pattern instead of a nested if block. Issue: BTC-2732 Co-authored-by: llm-git <llm-git@ttll.de>
1 parent 667008e commit d411c04

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

  • modules/abstract-utxo/test/unit/transaction/fixedScript

modules/abstract-utxo/test/unit/transaction/fixedScript/parsePsbt.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,24 +204,25 @@ describe('parseTransaction', function () {
204204
expectedImplicitExternalSpendAmount: 0n,
205205
});
206206

207-
if (test.network === utxolib.networks.bitcoin) {
208-
// extended test suite for bitcoin
209-
210-
describeParseTransactionWith(test, 'legacy', {
211-
txFormat: 'legacy',
212-
txParams: 'inferFromExplanation',
213-
expectedExplicitExternalSpendAmount: 2700n,
214-
expectedImplicitExternalSpendAmount: 0n,
215-
});
216-
217-
describeParseTransactionWith(test, 'empty recipients', {
218-
txParams: {
219-
recipients: [],
220-
changeAddress: undefined,
221-
},
222-
expectedExplicitExternalSpendAmount: 0n,
223-
expectedImplicitExternalSpendAmount: 2700n,
224-
});
207+
if (test.network !== utxolib.networks.bitcoin) {
208+
return;
225209
}
210+
// extended test suite for bitcoin
211+
212+
describeParseTransactionWith(test, 'legacy', {
213+
txFormat: 'legacy',
214+
txParams: 'inferFromExplanation',
215+
expectedExplicitExternalSpendAmount: 2700n,
216+
expectedImplicitExternalSpendAmount: 0n,
217+
});
218+
219+
describeParseTransactionWith(test, 'empty recipients', {
220+
txParams: {
221+
recipients: [],
222+
changeAddress: undefined,
223+
},
224+
expectedExplicitExternalSpendAmount: 0n,
225+
expectedImplicitExternalSpendAmount: 2700n,
226+
});
226227
});
227228
});

0 commit comments

Comments
 (0)