Adding Two Get Block Tests to SteemJs

in #steem13 hours ago

image.png

Two Get Block Tests

SteemJs gives a good smoke test of a particular steemjs version.

addTest("steem.api.getBlock", async () => {
    const data = await steemCall("getBlock", [102496700]);
    if (data.previous === "061bf9bb3389a026b4e07f3b28aaa24d87c639e1") return;
    throw new Error("getBlock return error");
});

steem.api.getDynamicGlobalProperties((err, result) => {
  if (err) {
    console.error(err);
    return;
  }

  const latestBlock = result.head_block_number;
  log('Latest block height:', latestBlock);
  addTest(`steem.api.getBlock (latest block height ${latestBlock})`, async () => {
    const data = await steemCall("getBlock", [latestBlock]);
    log(data);
    if (data.previous && data.witness && data.timestamp && data.witness_signature) return;
    throw new Error(`getBlock (latest block height: ${latestBlock}) return error`);
    })  
});

Steem to the Moon🚀!

Support me, thank you!

Why you should vote me? My contributions
Please vote me as a witness or set me as a proxy via https://steemitwallet.com/~witnesses

image.png

Sort:  

Great post! Featured in the hot section by @punicwax.