Compare commits

..
5 Commits
Author SHA1 Message Date
Chris Troutner ec2d8ea80a Merge pull request #83 from Permissionless-Software-Foundation/ct-unstable
fix(tests): Updated unit and integration tests
2021-01-07 17:52:02 -08:00
Chris Troutner fc527834ea Merge branch 'master' into ct-unstable 2021-01-07 17:44:56 -08:00
Chris Troutner 3ceebc1f12 fix(tests): Updated unit and integration tests 2021-01-07 17:44:04 -08:00
Chris Troutner 2ff46c1f76 Merge pull request #82 from Permissionless-Software-Foundation/ct-unstable
fix(axios): Updating axios
2021-01-04 14:49:11 -08:00
Chris Troutner 6926bbe113 fix(axios): Updating axios 2021-01-04 14:44:48 -08:00
7 changed files with 803 additions and 272 deletions
+772 -243
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -14,10 +14,10 @@
"test:integration:bchn": "export RESTURL=https://bchn.fullstack.cash/v4/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
"test:integration:testnet": "IS_USING_FREE_TIER=true mocha --timeout 30000 test/integration/chains/testnet/",
"test:integration:local": "RESTURL=http://localhost:3000/v4/ mocha --timeout 30000 test/integration",
"test:integration:local:bchn": "RESTURL=http://localhost:3000/v4/ bash test/integration/test-bchn-integration.sh",
"test:integration:local:bchn": "RESTURL=http://localhost:3000/v4/ mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
"test:integration:local:testnet": "RESTURL=http://localhost:4000/v4/ mocha --timeout 30000 test/integration/testnet",
"test:temp": "export RESTURL=https://bchn.fullstack.cash/v4/ && mocha --timeout 30000 -g '#getStatus' test/integration/",
"test:temp2": "mocha --timeout 30000 -g '#getStatus' test/unit/",
"test:temp": "export RESTURL=https://bchn.fullstack.cash/v4/ && mocha --timeout 30000 -g '#tokenUtxoDetails' test/integration/",
"test:temp2": "mocha --timeout 30000 -g '#generateSendOpReturn' test/unit/",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/",
"docs": "./node_modules/.bin/apidoc -i src/ -o docs",
@@ -32,9 +32,9 @@
"dependencies": {
"@uppy/core": "^1.10.4",
"@uppy/tus": "^1.5.12",
"apidoc": "^0.17.7",
"apidoc": "^0.25.0",
"assert": "^2.0.0",
"axios": "^0.19.0",
"axios": "^0.21.1",
"bc-bip68": "^1.0.5",
"bchaddrjs-slp": "^0.2.5",
"bigi": "^1.4.2",
@@ -87,7 +87,6 @@
"husky": "^4.3.6",
"lodash.clonedeep": "^4.5.0",
"mocha": "^6.1.4",
"nock": "^10.0.6",
"node-mocks-http": "^1.7.0",
"nyc": "^14.1.0",
"prettier": "^1.18.2",
+2 -2
View File
@@ -118,11 +118,11 @@ class TokenType1 {
// Convert the send quantity to the format expected by slp-mdm.
const baseQty = sendQtyBig.toString()
// console.log(`baseQty: `, baseQty)
console.log('baseQty: ', baseQty)
// Convert the change quantity to the format expected by slp-mdm.
const baseChange = change.toString()
// console.log(`baseChange: `, baseChange)
console.log('baseChange: ', baseChange)
// Check for potential burns
const outputQty = new BigNumber(baseChange).plus(
+3 -3
View File
@@ -1136,7 +1136,7 @@ class Utils {
err.message.indexOf('trailing data') === -1)
) {
// console.log(
// `unknown error from decodeOpReturn(). Marking as 'null'`,
// 'unknown error from decodeOpReturn(). Marking as \'null\'',
// err
// )
@@ -1147,7 +1147,7 @@ class Utils {
// an SLP UTXO.
// Mark as false and continue the loop.
} else {
// console.log("marking as invalid")
// console.log('marking as invalid')
utxo.isValid = false
outAry.push(utxo)
}
@@ -1254,7 +1254,7 @@ class Utils {
// Figure out what token quantity is represented by this utxo.
const tokenQty = slpData.amounts[utxo.vout - 1]
// console.log(`tokenQty: `, tokenQty)
// console.log('tokenQty: ', tokenQty)
if (!tokenQty) {
// outAry[i] = false
+2 -2
View File
@@ -743,8 +743,8 @@ describe('#SLP', () => {
const tokenUtxos = [
{
tokenId:
'0a321bff9761f28e06a268b14711274bb77617410a16807bd0437ef234a072b1',
decimals: 0,
'38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0',
decimals: 8,
tokenQty: 2
}
]
-8
View File
@@ -3,7 +3,6 @@
*/
const assert = require('chai').assert
const nock = require('nock') // http call mocking
const sinon = require('sinon')
// const axios = require("axios")
@@ -24,17 +23,10 @@ describe('#SLP NFT1', () => {
let sandbox
beforeEach(() => {
// Activate nock if it's inactive.
if (!nock.isActive()) nock.activate()
sandbox = sinon.createSandbox()
})
afterEach(() => {
// Clean up HTTP mocks.
nock.cleanAll() // clear interceptor list.
nock.restore()
sandbox.restore()
})
+19 -8
View File
@@ -3,7 +3,6 @@
*/
const assert = require('chai').assert
const nock = require('nock') // http call mocking
const sinon = require('sinon')
// const axios = require("axios")
@@ -24,17 +23,10 @@ describe('#SLP TokenType1', () => {
let sandbox
beforeEach(() => {
// Activate nock if it's inactive.
if (!nock.isActive()) nock.activate()
sandbox = sinon.createSandbox()
})
afterEach(() => {
// Clean up HTTP mocks.
nock.cleanAll() // clear interceptor list.
nock.restore()
sandbox.restore()
})
@@ -1186,6 +1178,25 @@ describe('#SLP TokenType1', () => {
})
})
describe('#generateSendOpReturn07', () => {
it('should generate send OP_RETURN code', () => {
// Mock UTXO.
const tokenUtxos = [
{
tokenId: '38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0',
decimals: 8,
tokenQty: 2
}
]
const result = bchjs.SLP.TokenType1.generateSendOpReturn(tokenUtxos, 1.5)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.hasAllKeys(result, ['script', 'outputs'])
assert.isNumber(result.outputs)
})
})
describe('#generateBurnOpReturn', () => {
it('should generate burn OP_RETURN code', () => {
// Mock UTXO.