Browse Source

update tests

main
Esteban Santiesteban 1 month ago
parent
commit
dc93d0f680
1 changed files with 13 additions and 4 deletions
  1. 13
    4
      code/tests.js

+ 13
- 4
code/tests.js View File

@@ -13,20 +13,25 @@ function validate(name, value, type, output) {

;(async () => {

var address = `nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o` // Nano.to
var address2 = `nano_1xkyayfycettzcyhbexcmtqbhj5abbruq15urypzsnrby9s8nrhpj6fzxqcg` // Random Address

console.clear()

var startTime = Date.now();

// Price from Nano.to, CoinMarketCap cached for 60 seconds.
validate( "Nano.price()", await Nano.price(), 'number')

// Price from CoinMarketCap
// check( "Nano.price({ config })", (await api.price({ key: '{{ API_KEY }}' })).price, 'number')
var account = await Nano.account('nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o')
var account = await Nano.account(address)
validate( "Nano.account()", account.balance, 'string')

var pending = await Nano.pending('nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o')
var pending = await Nano.pending(address)
validate( "Nano.pending()", pending, 'object')

var history = await Nano.history('nano_1xkyayfycettzcyhbexcmtqbhj5abbruq15urypzsnrby9s8nrhpj6fzxqcg')
var history = await Nano.history(address2)
validate( "Nano.address()", history, 'object')

var rawAmount = '19424000000000000000000000000'
@@ -36,7 +41,11 @@ function validate(name, value, type, output) {
var convertToRaw = Nano.toRaw(convertFromRaw)
validate( "Nano.toRaw()", convertToRaw, 'string')

var findBlockByAmount = Nano.findBlockByAmount("nano_1xkyayfycettzcyhbexcmtqbhj5abbruq15urypzsnrby9s8nrhpj6fzxqcg", history[0].amount)
var findBlockByAmount = Nano.findBlockByAmount(address2, history[0].amount)
validate( "Nano.findBlockByAmount()", findBlockByAmount, 'object')

var elapsedTime = Date.now() - startTime;

console.log("Finished in", `${elapsedTime}ms`)

})()

Loading…
Cancel
Save