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");
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ common:
|
||||
Content-Type: application/json
|
||||
qa:
|
||||
api_base_url: https://qwerty-validator-api.qa.nymte.ch/api/v1
|
||||
mix_id: 7
|
||||
mix_id: 63
|
||||
identity_key: 4Yr4qmEHd9sgsuQ83191FR2hD88RfsbMmB4tzhhZWriz
|
||||
gateway_identity: 336yuXAeGEgedRfqTJZsG2YV7P13QH1bHv1SjCZYarc9
|
||||
log_level: error
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
InclusionProbabilities,
|
||||
InclusionProbability,
|
||||
NodeHistory,
|
||||
NoUptime,
|
||||
Report,
|
||||
RewardEstimation,
|
||||
StakeSaturation,
|
||||
@@ -36,7 +37,7 @@ export default class Status extends APIClient {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGatewayHistory(identity_key: string): Promise<NodeHistory> {
|
||||
public async getGatewayHistory(identity_key: string): Promise<NodeHistory | NoUptime> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/gateway/${identity_key}/history`,
|
||||
});
|
||||
@@ -111,7 +112,7 @@ export default class Status extends APIClient {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeHistory(mix_id: number): Promise<NodeHistory> {
|
||||
public async getMixnodeHistory(mix_id: number): Promise<NodeHistory | NoUptime> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${mix_id}/history`,
|
||||
});
|
||||
|
||||
@@ -27,13 +27,6 @@ export interface Node {
|
||||
in_active_set: boolean;
|
||||
}
|
||||
|
||||
export interface RewardEstimation {
|
||||
estimation: Estimation;
|
||||
reward_params: RewardParams;
|
||||
epoch: Epoch;
|
||||
as_at: number;
|
||||
}
|
||||
|
||||
export interface Estimation {
|
||||
total_node_reward: string;
|
||||
operator: string;
|
||||
@@ -41,6 +34,13 @@ export interface Estimation {
|
||||
operating_cost: string;
|
||||
}
|
||||
|
||||
export interface RewardEstimation {
|
||||
estimation: Estimation;
|
||||
reward_params: RewardParams;
|
||||
epoch: Epoch;
|
||||
as_at: number;
|
||||
}
|
||||
|
||||
export interface RewardParams {
|
||||
interval: Interval;
|
||||
rewarded_set_size: number;
|
||||
@@ -129,6 +129,10 @@ export interface NodeHistory {
|
||||
history: History[];
|
||||
}
|
||||
|
||||
export interface NoUptime {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface CoreCount {
|
||||
mix_id: number;
|
||||
identity: string;
|
||||
@@ -162,9 +166,16 @@ export interface GatewayBond {
|
||||
proxy?: any;
|
||||
}
|
||||
|
||||
export interface nodePerformance {
|
||||
most_recent: string;
|
||||
last_hour: string;
|
||||
last_24h: string;
|
||||
}
|
||||
|
||||
export interface DetailedGateway {
|
||||
gateway_bond: GatewayBond;
|
||||
performance: string;
|
||||
node_performance: nodePerformance;
|
||||
}
|
||||
|
||||
export interface OriginalPledge {
|
||||
|
||||
Reference in New Issue
Block a user