Skip to content

Commit

Permalink
use the api to verify the web3.clientVersion test (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelamouche authored Jan 5, 2021
1 parent f27b277 commit ae8c28e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/tests/test-web3api.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { expect } from "chai";
import { step } from "mocha-steps";
import { describeWithMoonbeam, customRequest } from "./util";

describeWithMoonbeam("Moonbeam RPC (Web3Api)", `simple-specs.json`, (context) => {
step("should get client version", async function () {
it("should get client version", async function () {
const version = await context.web3.eth.getNodeInfo();
expect(version).to.be.match(/moonbeam-standalone\/v[0-9]+\.0\/fc-rpc-0.1.0/);
let specName: string = await context.polkadotApi.runtimeVersion.specName.toString();
let specVersion: string = await context.polkadotApi.runtimeVersion.specVersion.toString();
let regex = new RegExp(specName + "/v" + specVersion + "+.0/fc-rpc-0.1.0");
expect(version).to.be.match(regex);
});

step("should remote sha3", async function () {
it("should remote sha3", async function () {
const data = context.web3.utils.stringToHex("hello");
const hash = await customRequest(context.web3, "web3_sha3", [data]);
const local_hash = context.web3.utils.sha3("hello");
Expand Down

0 comments on commit ae8c28e

Please sign in to comment.