49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { PaymentMethod } from '../../modules/payment/types/PaymentMethod';
|
|
import { resolveInvoiceRequiredConfirmations } from './resolveInvoiceRequiredConfirmations';
|
|
|
|
describe('resolveInvoiceRequiredConfirmations', () => {
|
|
it('returns required confirmations for XMR invoices', () => {
|
|
expect(
|
|
resolveInvoiceRequiredConfirmations({
|
|
paymentMethod: PaymentMethod.Xmr,
|
|
moneroDetails: { requiredConfirmations: 3 }
|
|
})
|
|
).toBe(3);
|
|
});
|
|
|
|
it('throws when monero details are missing', () => {
|
|
expect(() =>
|
|
resolveInvoiceRequiredConfirmations({
|
|
paymentMethod: PaymentMethod.Xmr,
|
|
moneroDetails: null
|
|
})
|
|
).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: 'eth' as PaymentMethod
|
|
})
|
|
).toThrow('Invoice is missing eth required confirmations');
|
|
});
|
|
});
|