diff --git a/test/unit/price.js b/test/unit/price.js index 18f043c..6432894 100644 --- a/test/unit/price.js +++ b/test/unit/price.js @@ -58,16 +58,6 @@ describe('#price', () => { }) }) - describe('#getBchaUsd', () => { - it('should get the USD price of BCHA', async () => { - sandbox.stub(bchjs.Price.axios, 'get').resolves({ data: { usd: 18.87 } }) - - const result = await bchjs.Price.getBchaUsd() - // console.log(result) - - assert.isNumber(result) - }) - }) describe('#getBchUsd', () => { it('should get the USD price of BCH', async () => { sandbox.stub(bchjs.Price.axios, 'get').resolves({ data: { usd: 510.39 } }) diff --git a/test/unit/util.js b/test/unit/util.js index a8ea6d8..ac7e291 100644 --- a/test/unit/util.js +++ b/test/unit/util.js @@ -1,40 +1,18 @@ -import assert from 'assert' +/* + Unit tests for util.js library. +*/ + +// Global npm libraries import chai from 'chai' -import axios from 'axios' + +// Local libraries import BCHJS from '../../src/bch-js.js' -import sinon from 'sinon' +// import sinon from 'sinon' const { assert: assert2 } = chai + const bchjs = new BCHJS() describe('#Util', () => { - describe('#validateAddress', () => { - let sandbox - beforeEach(() => (sandbox = sinon.createSandbox())) - afterEach(() => sandbox.restore()) - - it('should validate address', done => { - const data = { - isvalid: true, - address: 'bitcoincash:qpz7qtkuyhrsz4qmnnrvf8gz9zd0u9v7eqsewyk4w5', - scriptPubKey: '76a91445e02edc25c701541b9cc6c49d02289afe159ec888ac', - ismine: false, - iswatchonly: false, - isscript: false - } - - const resolved = new Promise(resolve => resolve({ data })) - sandbox.stub(axios, 'get').returns(resolved) - - bchjs.Util.validateAddress( - 'bitcoincash:qpz7qtkuyhrsz4qmnnrvf8gz9zd0u9v7eqsewyk4w5' - ) - .then(result => { - assert.deepStrictEqual(data, result) - }) - .then(done, done) - }) - }) - describe('#floor8', () => { it('should floor a number to 8 decimals', () => { const num = 1.234567891111