diff --git a/package.json b/package.json index f77be21..007b5a2 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "test:all": "export SVC_ENV=test && nyc --reporter=text mocha --exit --timeout 15000 --recursive test/unit test/e2e/automated/", "test:unit": "export SVC_ENV=test && mocha --exit --timeout 15000 --recursive test/unit/", "test:e2e:auto": "export SVC_ENV=test && mocha --exit --timeout 30000 test/e2e/automated/", + "test:integration": "export SVC_ENV=test && mocha --timeout 30000 --recursive test/integration/", "test:temp": "export SVC_ENV=test && mocha --exit --timeout 15000 -g '#rate-limit' test/unit/json-rpc/", "lint": "standard --env mocha --fix", "docs": "./node_modules/.bin/apidoc -i src/ -o docs", diff --git a/src/adapters/index.js b/src/adapters/index.js index 65ece24..f367735 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -47,8 +47,10 @@ class Adapters { this.bchjs = new BCHJS({ restURL: this.config.apiServer }) } - // Start the IPFS node. - await this.ipfs.start({ bchjs: this.bchjs }) + if (this.config.env !== 'test') { + // Start the IPFS node. + await this.ipfs.start({ bchjs: this.bchjs }) + } } catch (err) { console.error('Error in adapters/index.js/start()') throw err diff --git a/test/integration/use-cases/bch/index-bch.use-cases.integration.js b/test/integration/use-cases/bch/index-bch.use-cases.integration.js new file mode 100644 index 0000000..2ca583b --- /dev/null +++ b/test/integration/use-cases/bch/index-bch.use-cases.integration.js @@ -0,0 +1,33 @@ +/* + Integration tests for the BCH Use Cases library +*/ + +// Local libraries +const BCHUseCases = require('../../../../src/use-cases/bch') +const Adapters = require('../../../../src/adapters') + +describe('#BCH', () => { + let uut + + before(async () => { + const adapters = new Adapters() + await adapters.start() + + uut = new BCHUseCases({ adapters }) + }) + + describe('#getTransactions', () => { + it('should get transactions for an address', async () => { + const rpcData = { + payload: { + params: { + addresses: ['bitcoincash:thing'] + } + } + } + + const result = await uut.getTransactions(rpcData) + console.log('result: ', result) + }) + }) +})