2021-03-23 17:11:37 -07:00
|
|
|
/*
|
|
|
|
|
Unit tests for the transaction.js library.
|
|
|
|
|
*/
|
2021-03-24 07:24:08 -07:00
|
|
|
|
|
|
|
|
// Public npm libraries
|
2025-11-16 13:37:04 -08:00
|
|
|
import chai from 'chai'
|
|
|
|
|
import sinon from 'sinon'
|
|
|
|
|
// import cloneDeep from 'lodash.clonedeep'
|
2021-03-24 07:24:08 -07:00
|
|
|
|
2025-11-16 13:37:04 -08:00
|
|
|
import BCHJS from '../../src/bch-js.js'
|
|
|
|
|
const { assert } = chai
|
2021-03-24 07:24:08 -07:00
|
|
|
const bchjs = new BCHJS()
|
|
|
|
|
|
2022-03-19 06:49:43 -07:00
|
|
|
// const mockDataLib = require('./fixtures/transaction-mock.js')
|
2021-03-24 07:24:08 -07:00
|
|
|
|
|
|
|
|
describe('#TransactionLib', () => {
|
2022-03-19 06:49:43 -07:00
|
|
|
let sandbox
|
2021-11-03 07:53:42 -07:00
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
sandbox = sinon.createSandbox()
|
|
|
|
|
|
2022-03-19 06:49:43 -07:00
|
|
|
// mockData = cloneDeep(mockDataLib)
|
2021-11-03 07:53:42 -07:00
|
|
|
})
|
2021-03-24 07:24:08 -07:00
|
|
|
afterEach(() => sandbox.restore())
|
|
|
|
|
|
2022-01-17 19:12:12 -08:00
|
|
|
describe('#get', () => {
|
|
|
|
|
it('should proxy psf-slp-indexer', async () => {
|
|
|
|
|
// console.log('bchjs.Transaction: ', bchjs.Transaction)
|
|
|
|
|
sandbox.stub(bchjs.Transaction.psfSlpIndexer, 'tx').resolves('test data')
|
|
|
|
|
|
|
|
|
|
const result = await bchjs.Transaction.get()
|
|
|
|
|
|
|
|
|
|
assert.equal(result, 'test data')
|
|
|
|
|
})
|
|
|
|
|
})
|
2021-03-24 07:24:08 -07:00
|
|
|
})
|