Unit tests should not call external services. That's the primary difference between unit tests and integration tests. Instead of making live calls with BITBOX, this mocking library can be used instead.
In a normal app, you would instantiate BITBOX accordingly:
const BITBOXSDK =const BITBOX =const result = BITBOXAddress
In your unit tests, you can use this mocking library to replace the
object like so:
const BITBOX =const result = BITBOXAddress
This mocking library depends on Sinon for mocking. If you want to mock a specific data set, you can override the default return values like this:
const sinon =const BITBOX =// This is an example of your own mocked data.const myMockData =balance: 0324cashAddress: 'bchtest:qzsfqeqtdk6plsvglccadkqtf0trf2nyz58090e6tt'BITBOXAddressdetails = sinonconst result = BITBOXAddress