some small api test fixes
This commit is contained in:
@@ -34,7 +34,7 @@ describe("Get mixnode data", (): void => {
|
||||
expect(typeof mixnode.bond_information.mix_node.verloc_port).toBe("number");
|
||||
expect(typeof mixnode.bond_information.mix_node.mix_port).toBe("number");
|
||||
expect(mixnode.bond_information.mix_node.mix_port).toStrictEqual(1789);
|
||||
expect(mixnode.bond_information.mix_node.verloc_port).toStrictEqual(1790);
|
||||
expect(typeof mixnode.bond_information.mix_node.verloc_port).toBe("number");
|
||||
|
||||
const identitykey = mixnode.bond_information.mix_node.identity_key;
|
||||
if (typeof identitykey === "string") {
|
||||
@@ -96,7 +96,7 @@ describe("Get mixnode data", (): void => {
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.verloc_port).toBe("number");
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.mix_port).toBe("number");
|
||||
expect(mixnode.mixnode_details.bond_information.mix_node.mix_port).toStrictEqual(1789);
|
||||
expect(mixnode.mixnode_details.bond_information.mix_node.verloc_port).toStrictEqual(1790);
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.verloc_port).toBe("number");
|
||||
|
||||
const identitykey2 = mixnode.mixnode_details.bond_information.mix_node.identity_key
|
||||
if (typeof identitykey2 === "string") {
|
||||
|
||||
@@ -15,19 +15,24 @@ describe("Get gateway data", (): void => {
|
||||
response.forEach((x) => {
|
||||
expect(typeof x.gateway_bond.owner).toBe("string");
|
||||
expect(typeof x.performance).toBe("string");
|
||||
expect(typeof x.node_performance.last_24h).toBe("string");
|
||||
});
|
||||
});
|
||||
|
||||
it("Get a gateway history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayHistory(identity_key);
|
||||
response.history.forEach((x) => {
|
||||
expect(typeof x.date).toBe("string");
|
||||
expect(typeof x.uptime).toBe("number");
|
||||
});
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
if ("identity" in response) {
|
||||
response.history.forEach((x) => {
|
||||
expect(typeof x.date).toBe("string");
|
||||
expect(typeof x.uptime).toBe("number");
|
||||
});
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
it("Get gateway core status count", async (): Promise<void> => {
|
||||
|
||||
@@ -39,13 +39,16 @@ describe("Get mixnode data", (): void => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeHistory(identity_key);
|
||||
|
||||
response.history.forEach((x) => {
|
||||
expect(typeof x.date).toBe("string");
|
||||
expect(typeof x.uptime).toBe("number");
|
||||
});
|
||||
|
||||
expect(identity_key).toStrictEqual(response.mix_id);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
if ("mix_id" in response) {
|
||||
response.history.forEach((x) => {
|
||||
expect(typeof x.date).toBe("string");
|
||||
expect(typeof x.uptime).toBe("number");
|
||||
});
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
it("Get a mixnode core count", async (): Promise<void> => {
|
||||
@@ -109,7 +112,7 @@ describe("Compute mixnode reward estimation", (): void => {
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
it("with correct data", async (): Promise<void> => {
|
||||
const response = await status.sendMixnodeRewardEstimatedComputation(7);
|
||||
const response = await status.sendMixnodeRewardEstimatedComputation(63);
|
||||
|
||||
expect(typeof response.estimation.delegates).toBe("string");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user