Skip to content

Commit

Permalink
Create stake.cs-e2e.ts (#1407)
Browse files Browse the repository at this point in the history
* Create stake.cs-e2e.ts

* Update stake.cs-e2e.ts
  • Loading branch information
cfaur09 authored Dec 3, 2024
1 parent 4b591c7 commit be170eb
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/test/chain-simulator/stake.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import axios from "axios";
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";

describe('Stake e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /stake', () => {
let stakeResponse: any;

beforeEach(async () => {
stakeResponse = await axios.get(`${config.apiServiceUrl}/stake`);
});

it('should return status code 200 and a stake object', () => {
expect(stakeResponse.status).toBe(200);
expect(stakeResponse.data).toBeInstanceOf(Object);
});

it('should return the correct total number of validators', () => {
expect(stakeResponse.data.totalValidators).toBeGreaterThanOrEqual(0);
});

it('should return the correct number of active validators', () => {
expect(stakeResponse.data.activeValidators).toBeGreaterThanOrEqual(0);
});

it('should return the correct number of total observers', () => {
expect(stakeResponse.data.totalObservers).toBeGreaterThanOrEqual(0);
});

it('should return the correct queue size', () => {
expect(stakeResponse.data.queueSize).toBeGreaterThanOrEqual(0);
});

it('should return all expected properties in the response', () => {
const expectedProperties = [
'totalValidators',
'activeValidators',
'totalObservers',
'queueSize',
'totalStaked',
];

for (const property of expectedProperties) {
expect(stakeResponse.data).toHaveProperty(property);
}
});
});
});

0 comments on commit be170eb

Please sign in to comment.