Skip to content

Commit

Permalink
test: fix spv test when cpu is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
braydonf committed Jun 27, 2019
1 parent 857d07c commit 7b41f51
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions test/wallet-http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ describe('Wallet TX HTTP Pagination', function() {
await generateTxs({
wclient,
spvwclient,
count: 38,
count: 19,
amount: 0.0001,
gap: 12,
gap: 6,
sleep: 2000
});

Expand Down Expand Up @@ -219,40 +219,40 @@ describe('Wallet TX HTTP Pagination', function() {
limit: 50,
reverse: true
});
assert.strictEqual(history.length, 38);
assert.strictEqual(history.length, 19);
assert.strictEqual(history[0].confirmations, 0);
const a = history[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(history[37].confirmations, 0);
const b = history[37].mtime;
assert.strictEqual(history[18].confirmations, 0);
const b = history[18].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a > b, true);
});

it('second page', async () => {
const one = await wclient.get('/wallet/test/tx/unconfirmed', {
limit: 15,
limit: 4,
reverse: true
});

const after = one[14].hash;
const after = one[3].hash;

const two = await wclient.get('/wallet/test/tx/unconfirmed', {
after: after,
limit: 25,
reverse: true
});

assert.strictEqual(two.length, 23);
assert.strictEqual(two.length, 15);
assert.strictEqual(two[0].confirmations, 0);
const a = two[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(two[22].confirmations, 0);
const b = two[22].mtime;
assert.strictEqual(two[14].confirmations, 0);
const b = two[14].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a > b, true);

assert.notStrictEqual(two[0].hash, one[14].hash);
assert.notStrictEqual(two[0].hash, one[3].hash);
});
});

Expand All @@ -262,12 +262,12 @@ describe('Wallet TX HTTP Pagination', function() {
limit: 50,
reverse: false
});
assert.strictEqual(history.length, 38);
assert.strictEqual(history.length, 19);
assert.strictEqual(history[0].confirmations, 0);
const a = history[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(history[37].confirmations, 0);
const b = history[37].mtime;
assert.strictEqual(history[18].confirmations, 0);
const b = history[18].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a < b, true);
});
Expand All @@ -283,29 +283,29 @@ describe('Wallet TX HTTP Pagination', function() {

it('second page', async () => {
const one = await wclient.get('/wallet/test/tx/unconfirmed', {
limit: 15,
limit: 4,
reverse: false
});
assert.strictEqual(one.length, 15);
assert.strictEqual(one.length, 4);

const after = one[14].hash;
const after = one[3].hash;

const two = await wclient.get('/wallet/test/tx/unconfirmed', {
after: after,
limit: 25,
reverse: false
});

assert.strictEqual(two.length, 23);
assert.strictEqual(two.length, 15);
assert.strictEqual(two[0].confirmations, 0);
const a = two[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(two[22].confirmations, 0);
const b = two[22].mtime;
assert.strictEqual(two[14].confirmations, 0);
const b = two[14].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a < b, true);

assert.notStrictEqual(two[0].hash, one[14].hash);
assert.notStrictEqual(two[0].hash, one[3].hash);
});
});
});
Expand Down Expand Up @@ -382,39 +382,40 @@ describe('Wallet TX HTTP Pagination', function() {
limit: 50,
reverse: true
});
assert.strictEqual(history.length, 38);
assert.strictEqual(history.length, 19);
assert.strictEqual(history[0].confirmations, 0);
const a = history[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(history[37].confirmations, 0);
const b = history[37].mtime;
assert.strictEqual(history[18].confirmations, 0);
const b = history[18].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a > b, true);
});
it('second page', async () => {
const one = await spvwclient.get('/wallet/test/tx/unconfirmed', {
limit: 15,
limit: 4,
reverse: true
});
assert.strictEqual(one.length, 15);
assert.strictEqual(one.length, 4);

const after = one[14].hash;
const after = one[3].hash;

const two = await spvwclient.get('/wallet/test/tx/unconfirmed', {
after: after,
limit: 25,
reverse: true
});

assert.strictEqual(two.length, 23);
assert.strictEqual(two.length, 15);
assert.strictEqual(two[0].confirmations, 0);
const a = two[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(two[22].confirmations, 0);
const b = two[22].mtime;
assert.strictEqual(two[14].confirmations, 0);
const b = two[14].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a > b, true);
assert.notStrictEqual(two[0].hash, one[14].hash);

assert.notStrictEqual(two[0].hash, one[3].hash);
});
});

Expand All @@ -424,39 +425,39 @@ describe('Wallet TX HTTP Pagination', function() {
limit: 50,
reverse: false
});
assert.strictEqual(history.length, 38);
assert.strictEqual(history.length, 19);
assert.strictEqual(history[0].confirmations, 0);
const a = history[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(history[37].confirmations, 0);
const b = history[37].mtime;
assert.strictEqual(history[18].confirmations, 0);
const b = history[18].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a < b, true);
});
it('second page', async () => {
const one = await spvwclient.get('/wallet/test/tx/unconfirmed', {
limit: 15,
limit: 4,
reverse: false
});
assert.strictEqual(one.length, 15);
assert.strictEqual(one.length, 4);

const after = one[14].hash;
const after = one[3].hash;

const two = await spvwclient.get('/wallet/test/tx/unconfirmed', {
after: after,
limit: 25,
reverse: false
});

assert.strictEqual(two.length, 23);
assert.strictEqual(two.length, 15);
assert.strictEqual(two[0].confirmations, 0);
const a = two[0].mtime;
assert.strictEqual(Number.isInteger(a), true);
assert.strictEqual(two[22].confirmations, 0);
const b = two[22].mtime;
assert.strictEqual(two[14].confirmations, 0);
const b = two[14].mtime;
assert.strictEqual(Number.isInteger(b), true);
assert.strictEqual(a <= b, true);
assert.notStrictEqual(two[0].hash, one[14].hash);
assert.notStrictEqual(two[0].hash, one[3].hash);
});
});
});
Expand Down

0 comments on commit 7b41f51

Please sign in to comment.