linting and removing unused imports
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
import ContractCache from "../../src/endpoints/CirculatingSupply";
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get circulating supply", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get circulating supply amounts", async (): Promise<void> => {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import ContractCache from "../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get epoch info", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get epoch reward params", async (): Promise<void> => {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import ContractCache from "../../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get gateway data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get all gateways", async (): Promise<void> => {
|
||||
@@ -42,7 +39,7 @@ describe("Get gateway data", (): void => {
|
||||
const response = await contract.getBlacklistedGateways();
|
||||
if (response === null) {
|
||||
// no blacklisted gateways returns an empty array
|
||||
expect(response).toBeNull();
|
||||
expect(response).toBeNull();
|
||||
} else {
|
||||
response.forEach(function (value) {
|
||||
expect(typeof value).toBe("string");
|
||||
|
||||
@@ -238,7 +238,7 @@ describe("Get mixnode data", (): void => {
|
||||
const response = await contract.getBlacklistedMixnodes();
|
||||
if (response === null) {
|
||||
// no blacklisted mixnodes returns an empty array
|
||||
expect(response).toBeNull();;
|
||||
expect(response).toBeNull();
|
||||
} else {
|
||||
response.forEach(function (value) {
|
||||
expect(typeof value).toBe("string");
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
import ContractCache from "../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get service provider info", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
});
|
||||
|
||||
it("Get service providers", async (): Promise<void> => {
|
||||
const response = await contract.getServiceProviders();
|
||||
if ("[service_id]" in response) {
|
||||
response.services.forEach((x) => {
|
||||
expect(typeof x.service.nym_address.address).toBe("string");
|
||||
expect(typeof x.service.service_type).toBe("string");
|
||||
expect(typeof x.service.block_height).toBe("number");
|
||||
expect(typeof x.service.announcer).toBe("string");
|
||||
expect(typeof x.service.deposit.amount).toBe("string");
|
||||
expect(typeof x.service.deposit.denom).toBe("string");
|
||||
});
|
||||
} else if ("[ ]" in response) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
it("Get service providers", async (): Promise<void> => {
|
||||
const response = await contract.getServiceProviders();
|
||||
if ("[service_id]" in response) {
|
||||
response.services.forEach((x) => {
|
||||
expect(typeof x.service.nym_address.address).toBe("string");
|
||||
expect(typeof x.service.service_type).toBe("string");
|
||||
expect(typeof x.service.block_height).toBe("number");
|
||||
expect(typeof x.service.announcer).toBe("string");
|
||||
expect(typeof x.service.deposit.amount).toBe("string");
|
||||
expect(typeof x.service.deposit.denom).toBe("string");
|
||||
});
|
||||
} else if ("[ ]" in response) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,7 +40,9 @@ describe("Get gateway data", (): void => {
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
} else if ("message" in response) {
|
||||
expect(response.message).toContain("could not find uptime history associated with gateway");
|
||||
expect(response.message).toContain(
|
||||
"could not find uptime history associated with gateway"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,7 +60,9 @@ describe("Get gateway data", (): void => {
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.count).toBe("number");
|
||||
} else if ("message" in response) {
|
||||
expect(response.message).toContain("could not find uptime history associated with mixnode");
|
||||
expect(response.message).toContain(
|
||||
"could not find uptime history associated with mixnode"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ describe("Get mixnode data", (): void => {
|
||||
expect(identity_key).toStrictEqual(response.mix_id);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
} else if ("message" in response) {
|
||||
expect(response.message).toContain("could not find uptime history associated with mixnode");
|
||||
expect(response.message).toContain(
|
||||
"could not find uptime history associated with mixnode"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,7 +72,9 @@ describe("Get mixnode data", (): void => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeRewardComputation(identity_key);
|
||||
if ("estimation" in response) {
|
||||
expect(response.reward_params.interval.sybil_resistance).toStrictEqual("0.3");
|
||||
expect(response.reward_params.interval.sybil_resistance).toStrictEqual(
|
||||
"0.3"
|
||||
);
|
||||
expect(response.reward_params.active_set_size).toStrictEqual(240);
|
||||
expect(typeof response.reward_params.interval.reward_pool).toBe("string");
|
||||
} else if ("message" in response) {
|
||||
@@ -108,7 +112,9 @@ describe("Get mixnode data", (): void => {
|
||||
const response = await status.getUnfilteredMixnodes();
|
||||
response.forEach((x) => {
|
||||
expect(typeof x.stake_saturation).toBe("string");
|
||||
expect(typeof x.mixnode_details.rewarding_details.last_rewarded_epoch).toBe("number");
|
||||
expect(
|
||||
typeof x.mixnode_details.rewarding_details.last_rewarded_epoch
|
||||
).toBe("number");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,7 +122,9 @@ describe("Get mixnode data", (): void => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeStatus(identity_key);
|
||||
const unfiltered_mixnodes_response = await status.getUnfilteredMixnodes();
|
||||
const mixnode = unfiltered_mixnodes_response.find(x => x.mixnode_details.bond_information.mix_id === identity_key);
|
||||
const mixnode = unfiltered_mixnodes_response.find(
|
||||
(x) => x.mixnode_details.bond_information.mix_id === identity_key
|
||||
);
|
||||
if (mixnode) {
|
||||
expect(response.status).toStrictEqual("active");
|
||||
} else {
|
||||
@@ -127,7 +135,9 @@ describe("Get mixnode data", (): void => {
|
||||
it("Get all rewarded mixnodes", async (): Promise<void> => {
|
||||
const response = await status.getDetailedRewardedMixnodes();
|
||||
response.forEach((x) => {
|
||||
expect(typeof x.mixnode_details.rewarding_details.last_rewarded_epoch).toBe("number");
|
||||
expect(
|
||||
typeof x.mixnode_details.rewarding_details.last_rewarded_epoch
|
||||
).toBe("number");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -146,7 +156,9 @@ describe("Get mixnode data", (): void => {
|
||||
|
||||
it("with correct data", async (): Promise<void> => {
|
||||
const mix_id = config.environmnetConfig.mix_id;
|
||||
const response = await status.sendMixnodeRewardEstimatedComputation(mix_id);
|
||||
const response = await status.sendMixnodeRewardEstimatedComputation(
|
||||
mix_id
|
||||
);
|
||||
expect(typeof response.estimation.delegates).toBe("string");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ export interface EpochLength {
|
||||
}
|
||||
|
||||
export interface ServiceProviders {
|
||||
services: (Services)[];
|
||||
services: Services[];
|
||||
}
|
||||
export interface Services {
|
||||
service_id: number;
|
||||
@@ -145,4 +145,3 @@ export interface Deposit {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user