-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create stake.cs-e2e.ts * Update stake.cs-e2e.ts
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}); | ||
}); | ||
}); |