Skip to content

Commit

Permalink
fix stub
Browse files Browse the repository at this point in the history
  • Loading branch information
matiu committed Oct 16, 2019
1 parent 1de7bb1 commit c8f28b6
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions packages/bitcore-wallet-service/test/integration/history.js
Expand Up @@ -30,7 +30,7 @@ var helpers = require('./helpers');
var storage, blockchainExplorer, request;


describe('History V8', function() {
describe('History', function() {
before(function(done) {
helpers.before((res) => {
done();
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('History V8', function() {



describe('#getTxHistoryV8', function() {
describe('#getTxHistory', function() {
var server, wallet, mainAddresses, changeAddresses;
beforeEach(function(done) {
blockchainExplorer.getBlockchainHeight = sinon.stub().callsArgWith(0, null, BCHEIGHT, 'hash');
Expand All @@ -92,7 +92,7 @@ describe('History V8', function() {
});

it('should get tx history from insight, 20 items', function(done) {
helpers.stubHistoryV8(50, BCHEIGHT);
helpers.stubHistory(50, BCHEIGHT);
server.getTxHistory({limit: 20}, function(err, txs, fromCache) {
should.not.exist(err);
fromCache.should.equal(false);
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('History V8', function() {
txs[15].satoshis=10;
txs[25].satoshis=1;

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);
server.getTxHistory({limit: 50}, function(err, txs, fromCache) {
should.not.exist(err);
fromCache.should.equal(false);
Expand All @@ -139,7 +139,7 @@ describe('History V8', function() {
txs[1].satoshis = 10000;
txs[1].address='other address';

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);
server.getTxHistory({limit: 50}, function(err, txs, fromCache) {
should.not.exist(err);
fromCache.should.equal(false);
Expand Down Expand Up @@ -175,7 +175,7 @@ describe('History V8', function() {
txs[1].satoshis = 100;
txs[1].address='other address';

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);
server.getTxHistory({limit: 50}, function(err, txs, fromCache) {
should.not.exist(err);
fromCache.should.equal(false);
Expand Down Expand Up @@ -213,7 +213,7 @@ describe('History V8', function() {
txs[1].address =main[0].address;
txs[0].category=txs[1].category='move';

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);

server.getTxHistory({limit: 10}, function(err, txs, fromCache) {
should.not.exist(err);
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('History V8', function() {
txs[1].address =change[0].address;
txs[0].category=txs[1].category='move';

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);

server.getTxHistory({limit: 10}, function(err, txs, fromCache) {
should.not.exist(err);
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('History V8', function() {
txs[2].address =change[0].address;
txs[3].address =main[1].address;

helpers.stubHistoryV8(null, null, txs);
helpers.stubHistory(null, null, txs);

server.getTxHistory({limit: 10}, function(err, txs, fromCache) {
should.not.exist(err);
Expand Down Expand Up @@ -310,7 +310,7 @@ describe('History V8', function() {
it('should get tx history from cache', function(done) {
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 10;
helpers.stubHistoryV8(50, BCHEIGHT); //(0->49)
helpers.stubHistory(50, BCHEIGHT); //(0->49)

// this call is to fill the cache
server.getTxHistory({limit: 20}, function(err, txs, fromCache) {
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('History V8', function() {
it('should get tx history from cache and bc mixed', function(done) {
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 10;
helpers.stubHistoryV8(50, BCHEIGHT); //(0->49)
helpers.stubHistory(50, BCHEIGHT); //(0->49)

// this call is to fill the cache
server.getTxHistory({limit: 20}, function(err, txs, fromCache) {
Expand Down Expand Up @@ -385,7 +385,7 @@ describe('History V8', function() {

// remove bc tip cache.
Defaults.BLOCKHEIGHT_CACHE_TIME = 0;
helpers.stubHistoryV8(50, BCHEIGHT); //(0->49)
helpers.stubHistory(50, BCHEIGHT); //(0->49)

// this call is to fill the cache
server.getTxHistory({limit: 20}, function(err, txs, fromCache) {
Expand Down Expand Up @@ -415,7 +415,7 @@ describe('History V8', function() {
this.timeout(10000);
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 10;
helpers.stubHistoryV8(100, 10000);
helpers.stubHistory(100, 10000);
let limit =20;
let allTxs = [];

Expand Down Expand Up @@ -474,7 +474,7 @@ describe('History V8', function() {
this.timeout(10000);
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 10;
helpers.stubHistoryV8(1000, 10000); //(0->49)
helpers.stubHistory(1000, 10000); //(0->49)
let limit =20;
let allTxs = [];

Expand Down Expand Up @@ -527,7 +527,7 @@ describe('History V8', function() {
this.timeout(10000);
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 10;
helpers.stubHistoryV8(997, 10000); //(0->49)
helpers.stubHistory(997, 10000); //(0->49)
let limit =17;
let allTxs = [];

Expand Down Expand Up @@ -581,7 +581,7 @@ describe('History V8', function() {
this.timeout(10000);
var _cache = Defaults.CONFIRMATIONS_TO_START_CACHING;
Defaults.CONFIRMATIONS_TO_START_CACHING = 100;
helpers.stubHistoryV8(997, 10000); //(0->49)
helpers.stubHistory(997, 10000); //(0->49)
let limit =17;
let allTxs = [];

Expand Down Expand Up @@ -636,7 +636,7 @@ describe('History V8', function() {


it('should get tx history from insight, in 2 overlapping pages', function(done) {
helpers.stubHistoryV8(300, BCHEIGHT);
helpers.stubHistory(300, BCHEIGHT);
server.getTxHistory({limit: 25}, function(err, txs, fromCache) {
should.not.exist(err);
fromCache.should.equal(false);
Expand Down Expand Up @@ -726,7 +726,7 @@ describe('History V8', function() {
},
];

helpers.stubHistoryV8(null, null,txs);
helpers.stubHistory(null, null,txs);
helpers.stubCheckData(blockchainExplorer, server, wallet.coin == 'bch', () =>{

server.getTxHistory({
Expand Down Expand Up @@ -824,7 +824,7 @@ describe('History V8', function() {
},
];

helpers.stubHistoryV8(null, null,txs);
helpers.stubHistory(null, null,txs);
helpers.stubCheckData(blockchainExplorer, server, wallet.coin == 'bch', () =>{

server.getTxHistory({}, function(err, txs) {
Expand Down Expand Up @@ -930,7 +930,7 @@ describe('History V8', function() {
}],
};
});
helpers.stubHistoryV8(txs);
helpers.stubHistory(txs);

async.each(testCases, function(testCase, next) {
server.getTxHistory(testCase.opts, function(err, txs) {
Expand All @@ -954,7 +954,7 @@ describe('History V8', function() {
h.push({
txid: 'xx'
})
helpers.stubHistoryV8(h, BCHEIGHT);
helpers.stubHistory(h, BCHEIGHT);
var l = TestData.history.length;

server.getTxHistory({}, function(err, txs) {
Expand Down Expand Up @@ -1020,7 +1020,7 @@ describe('History V8', function() {
}],
size: 500,
}];
helpers.stubHistoryV8(txs, BCHEIGHT);
helpers.stubHistory(txs, BCHEIGHT);
server.getTxHistory({}, function(err, txs) {
should.not.exist(err);
var tx = txs[0];
Expand Down Expand Up @@ -1052,7 +1052,7 @@ describe('History V8', function() {
}],
size: 500,
}];
helpers.stubHistoryV8(txs);
helpers.stubHistory(txs);
server.getTxHistory({}, function(err, txs) {
should.not.exist(err);
var tx = txs[0];
Expand All @@ -1066,7 +1066,7 @@ describe('History V8', function() {
it.skip('should handle outgoing txs where fee > amount', function(done) {
var x = _.cloneDeep([HugeTxs[0]]);
x[0].vin[118].addr = mainAddresses[0].address;
helpers.stubHistoryV8(x);
helpers.stubHistory(x);


server.getTxHistory({}, function(err, txs) {
Expand All @@ -1089,7 +1089,7 @@ describe('History V8', function() {
var x = _.cloneDeep([HugeTxs[1]]);

x[0].vout[43].scriptPubKey.addresses = [mainAddresses[0].address];
helpers.stubHistoryV8(x);
helpers.stubHistory(x);

server.getTxHistory({}, function(err, txs) {
should.not.exist(err);
Expand All @@ -1110,7 +1110,7 @@ describe('History V8', function() {
beforeEach(function(done) {
blockchainExplorer.getBlockchainHeight = sinon.stub().callsArgWith(0, null, 1000, 'hash');
h = helpers.historyCacheTest(200);
helpers.stubHistoryV8(h, BCHEIGHT);
helpers.stubHistory(h, BCHEIGHT);
server.storage.clearTxHistoryCache(server.walletId, function() {
done();
});
Expand Down

0 comments on commit c8f28b6

Please sign in to comment.