bugfix: gateway average uptime test
This commit is contained in:
@@ -56,20 +56,18 @@ describe("Get gateway data", (): void => {
|
||||
it("Get gateway average uptime", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayAverageUptime(identity_key);
|
||||
if ("mix_id" in response) {
|
||||
if ("identity" in response) {
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.count).toBe("number");
|
||||
expect(typeof response.avg_uptime).toBe("number");
|
||||
} else if ("message" in response) {
|
||||
expect(response.message).toContain(
|
||||
"could not find uptime history associated with mixnode"
|
||||
);
|
||||
expect(response.message).toContain("gateway bond not found");
|
||||
}
|
||||
});
|
||||
|
||||
it("Get a gateway status report", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayStatusReport(identity_key);
|
||||
if ("mix_id" in response) {
|
||||
if ("identity" in response) {
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
expect(typeof response.most_recent).toBe("number");
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
CoreCount,
|
||||
DetailedGateway,
|
||||
DetailedMixnodes,
|
||||
GatewayUptimeResponse,
|
||||
InclusionProbabilities,
|
||||
InclusionProbability,
|
||||
NodeHistory,
|
||||
@@ -67,7 +68,7 @@ export default class Status extends APIClient {
|
||||
|
||||
public async getGatewayAverageUptime(
|
||||
identity_key: string
|
||||
): Promise<CoreCount | ErrorMsg> {
|
||||
): Promise<GatewayUptimeResponse | ErrorMsg> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/gateway/${identity_key}/avg_uptime`,
|
||||
});
|
||||
|
||||
@@ -168,6 +168,12 @@ export interface AvgUptime {
|
||||
node_performance: nodePerformance;
|
||||
}
|
||||
|
||||
export interface GatewayUptimeResponse {
|
||||
identity: string;
|
||||
avg_uptime: number;
|
||||
node_performance: nodePerformance;
|
||||
}
|
||||
|
||||
export interface DetailedGateway {
|
||||
gateway_bond: GatewayBond;
|
||||
performance: string;
|
||||
|
||||
Reference in New Issue
Block a user