refactor invoice required confirmations resolver to be more scalable for future confirmations based coins
This commit is contained in:
@@ -17,14 +17,32 @@ describe('resolveInvoiceRequiredConfirmations', () => {
|
||||
paymentMethod: PaymentMethod.Xmr,
|
||||
moneroDetails: null
|
||||
})
|
||||
).toThrow('Invoice is missing Monero required confirmations');
|
||||
).toThrow('Invoice is missing xmr required confirmations');
|
||||
});
|
||||
|
||||
it('returns required confirmations for BTC invoices', () => {
|
||||
expect(
|
||||
resolveInvoiceRequiredConfirmations({
|
||||
paymentMethod: PaymentMethod.Btc,
|
||||
btcDetails: { requiredConfirmations: 6 }
|
||||
})
|
||||
).toBe(6);
|
||||
});
|
||||
|
||||
it('throws when bitcoin details are missing', () => {
|
||||
expect(() =>
|
||||
resolveInvoiceRequiredConfirmations({
|
||||
paymentMethod: PaymentMethod.Btc,
|
||||
btcDetails: null
|
||||
})
|
||||
).toThrow('Invoice is missing btc required confirmations');
|
||||
});
|
||||
|
||||
it('throws for unsupported payment methods', () => {
|
||||
expect(() =>
|
||||
resolveInvoiceRequiredConfirmations({
|
||||
paymentMethod: 'btc' as PaymentMethod
|
||||
paymentMethod: 'eth' as PaymentMethod
|
||||
})
|
||||
).toThrow('Unsupported payment method: btc');
|
||||
).toThrow('Invoice is missing eth required confirmations');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user