refactor confirmation tiers to shared crypto-agnostic types and validation
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { resolveMinConfirmations } from './resolveMinConfirmations';
|
||||
|
||||
const tiers = [
|
||||
{ upToTotalFiat: '25', minConfirmations: 0 },
|
||||
{ upToTotalFiat: '250', minConfirmations: 5 },
|
||||
{ minConfirmations: 10 }
|
||||
] as const;
|
||||
|
||||
describe('resolveMinConfirmations', () => {
|
||||
it('returns 0 for small orders (tx-detected tier)', () => {
|
||||
expect(resolveMinConfirmations(10, [...tiers])).toBe(0);
|
||||
});
|
||||
|
||||
it('returns the middle tier for medium orders', () => {
|
||||
expect(resolveMinConfirmations(100, [...tiers])).toBe(5);
|
||||
});
|
||||
|
||||
it('returns the catch-all tier for large orders', () => {
|
||||
expect(resolveMinConfirmations(500, [...tiers])).toBe(10);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user