2025-11-16 13:37:04 -08:00
|
|
|
import chai from 'chai'
|
|
|
|
|
import BCHJS from '../../src/bch-js.js'
|
|
|
|
|
const { assert } = chai
|
2020-07-27 21:32:51 -07:00
|
|
|
const bchjs = new BCHJS()
|
|
|
|
|
|
2021-01-02 15:41:12 -08:00
|
|
|
describe('#price', () => {
|
2020-11-02 14:49:28 -08:00
|
|
|
beforeEach(async () => {
|
2021-08-09 14:54:49 -07:00
|
|
|
if (process.env.IS_USING_FREE_TIER) await sleep(1500)
|
2020-11-02 14:49:28 -08:00
|
|
|
})
|
|
|
|
|
|
2021-03-04 15:14:46 -04:00
|
|
|
describe('#getBchUsd', () => {
|
|
|
|
|
it('should get the USD price of BCH', async () => {
|
|
|
|
|
const result = await bchjs.Price.getBchUsd()
|
|
|
|
|
console.log(result)
|
|
|
|
|
|
|
|
|
|
assert.isNumber(result)
|
|
|
|
|
})
|
|
|
|
|
})
|
2020-11-17 14:41:04 -08:00
|
|
|
|
2024-09-03 19:28:22 -07:00
|
|
|
describe('#getPsffppPrice', () => {
|
|
|
|
|
it('should get the price of BCH in several currencies', async () => {
|
|
|
|
|
const result = await bchjs.Price.getPsffppPrice()
|
|
|
|
|
// console.log(result)
|
|
|
|
|
|
|
|
|
|
assert.isNumber(result)
|
|
|
|
|
})
|
|
|
|
|
})
|
2020-07-27 21:32:51 -07:00
|
|
|
})
|
2020-11-02 14:49:28 -08:00
|
|
|
|
2021-01-02 15:41:12 -08:00
|
|
|
function sleep (ms) {
|
2020-11-02 14:49:28 -08:00
|
|
|
return new Promise(resolve => setTimeout(resolve, ms))
|
|
|
|
|
}
|