mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 21:32:55 +01:00
fix tests
This commit is contained in:
parent
ee53597fe9
commit
9e05060af4
@ -1,5 +1,5 @@
|
|||||||
import { Common } from '../../api/common';
|
import { Common } from '../../api/common';
|
||||||
import { MempoolTransactionExtended } from '../../mempool.interfaces';
|
import { MempoolTransactionExtended, TransactionExtended } from '../../mempool.interfaces';
|
||||||
|
|
||||||
const randomTransactions = require('./test-data/transactions-random.json');
|
const randomTransactions = require('./test-data/transactions-random.json');
|
||||||
const replacedTransactions = require('./test-data/transactions-replaced.json');
|
const replacedTransactions = require('./test-data/transactions-replaced.json');
|
||||||
@ -10,14 +10,14 @@ describe('Common', () => {
|
|||||||
describe('RBF', () => {
|
describe('RBF', () => {
|
||||||
const newTransactions = rbfTransactions.concat(randomTransactions);
|
const newTransactions = rbfTransactions.concat(randomTransactions);
|
||||||
test('should detect RBF transactions with fast method', () => {
|
test('should detect RBF transactions with fast method', () => {
|
||||||
const result: { [txid: string]: MempoolTransactionExtended[] } = Common.findRbfTransactions(newTransactions, replacedTransactions);
|
const result: { [txid: string]: { replaced: MempoolTransactionExtended[], replacedBy: TransactionExtended }} = Common.findRbfTransactions(newTransactions, replacedTransactions);
|
||||||
expect(Object.values(result).length).toEqual(2);
|
expect(Object.values(result).length).toEqual(2);
|
||||||
expect(result).toHaveProperty('7219d95161f3718335991ac6d967d24eedec370908c9879bb1e192e6d797d0a6');
|
expect(result).toHaveProperty('7219d95161f3718335991ac6d967d24eedec370908c9879bb1e192e6d797d0a6');
|
||||||
expect(result).toHaveProperty('5387881d695d4564d397026dc5f740f816f8390b4b2c5ec8c20309122712a875');
|
expect(result).toHaveProperty('5387881d695d4564d397026dc5f740f816f8390b4b2c5ec8c20309122712a875');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should detect RBF transactions with scalable method', () => {
|
test('should detect RBF transactions with scalable method', () => {
|
||||||
const result: { [txid: string]: MempoolTransactionExtended[] } = Common.findRbfTransactions(newTransactions, replacedTransactions, true);
|
const result: { [txid: string]: { replaced: MempoolTransactionExtended[], replacedBy: TransactionExtended }} = Common.findRbfTransactions(newTransactions, replacedTransactions, true);
|
||||||
expect(Object.values(result).length).toEqual(2);
|
expect(Object.values(result).length).toEqual(2);
|
||||||
expect(result).toHaveProperty('7219d95161f3718335991ac6d967d24eedec370908c9879bb1e192e6d797d0a6');
|
expect(result).toHaveProperty('7219d95161f3718335991ac6d967d24eedec370908c9879bb1e192e6d797d0a6');
|
||||||
expect(result).toHaveProperty('5387881d695d4564d397026dc5f740f816f8390b4b2c5ec8c20309122712a875');
|
expect(result).toHaveProperty('5387881d695d4564d397026dc5f740f816f8390b4b2c5ec8c20309122712a875');
|
||||||
|
Loading…
Reference in New Issue
Block a user