add base mocks for nymd client
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
"@cosmjs/tendermint-rpc": "^0.27.0-rc2",
|
||||
"axios": "^0.21.1",
|
||||
"cosmjs-types": "^0.4.0",
|
||||
"dotenv": "^10.0.0"
|
||||
"dotenv": "^10.0.0",
|
||||
"moq.ts": "^7.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,8 +164,6 @@ describe("long running e2e tests", () => {
|
||||
test.only("delegate to mixnode, then undelegate", async () => {
|
||||
|
||||
const pledge = buildCoin("100000000", config.CURRENCY_DENOM)
|
||||
const getBalance = await validatorClient.getBalance(config.USER_WALLET_ADDRESS);
|
||||
console.log(getBalance);
|
||||
|
||||
try {
|
||||
response = await validatorClient.delegateToMixNode(
|
||||
|
||||
@@ -13,6 +13,8 @@ describe("init the validator api querier", () => {
|
||||
//all mixnodes will have their owners address
|
||||
let response = await client.getRewardedMixnodes();
|
||||
|
||||
console.log(response);
|
||||
|
||||
//this is dependany on config and network amend shortly
|
||||
response.forEach((Node) => {
|
||||
expect(Node.owner.length).toStrictEqual(43);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Mock, Times } from "moq.ts";
|
||||
import { INymdQuery } from "../../src/query-client";
|
||||
|
||||
describe("nym-client mocks", () => {
|
||||
beforeAll(() => {});
|
||||
|
||||
afterEach(() => {});
|
||||
|
||||
test.only("nymd mocks", async () => {
|
||||
let contract = "mixnet_contract";
|
||||
let response = Promise.resolve(Number(200));
|
||||
|
||||
const client = new Mock<INymdQuery>()
|
||||
.setup((nym) => nym.getIntervalRewardPercent(contract))
|
||||
.returns(response);
|
||||
|
||||
const obj = client.object();
|
||||
|
||||
let execute = await obj.getIntervalRewardPercent(contract);
|
||||
|
||||
client.verify(
|
||||
(nym) => nym.getIntervalRewardPercent(contract),
|
||||
Times.Exactly(1)
|
||||
);
|
||||
|
||||
expect(execute).toStrictEqual(await response);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3149,6 +3149,13 @@ minimist@^1.2.0, minimist@^1.2.5:
|
||||
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
|
||||
moq.ts@^7.3.4:
|
||||
version "7.3.4"
|
||||
resolved "https://registry.yarnpkg.com/moq.ts/-/moq.ts-7.3.4.tgz#982c3b195a54fd58c7a40a84e37a870374d15927"
|
||||
integrity sha512-rOelPx7ns+RzyliPwHH2wFVqGowITKRQtECLvVKhiIt4oM4r2hYq4AmgQh0NpWlMxWl2fuZtPJhikrhVpAoF5g==
|
||||
dependencies:
|
||||
tslib "2.1.0"
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
|
||||
@@ -3939,6 +3946,11 @@ tsconfig-paths@^3.12.0:
|
||||
minimist "^1.2.0"
|
||||
strip-bom "^3.0.0"
|
||||
|
||||
tslib@2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
|
||||
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
|
||||
|
||||
tslib@^1.8.1:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz"
|
||||
|
||||
Reference in New Issue
Block a user