WIP
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: Tests for validator API
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "validator-api/tests/**"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: validator-api/tests
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: validator api tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Node v18
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.1.0
|
||||
|
||||
- name: Install yarn
|
||||
run: yarn install
|
||||
|
||||
- name: Run yarn
|
||||
run: yarn
|
||||
|
||||
- name: Launch tests
|
||||
run: yarn test
|
||||
working-directory: validator-api/tests
|
||||
@@ -122,3 +122,6 @@ mixnet-opt: wasm
|
||||
generate-typescript:
|
||||
cd tools/ts-rs-cli && cargo run && cd ../..
|
||||
yarn types:lint:fix
|
||||
|
||||
run-validator-tests:
|
||||
cd validator-api/tests/functional_test && yarn test
|
||||
@@ -130,9 +130,10 @@ describe("Get mixnode data", (): void => {
|
||||
expect(typeof response.in_reserve).toBe("string");
|
||||
});
|
||||
|
||||
it.skip("Post to compute mixnode reward estimation", async ():Promise<void> => {
|
||||
it("Post to compute mixnode reward estimation", async ():Promise<void> => {
|
||||
const mix_id = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeRewardEstimatedComputation(mix_id);
|
||||
const payload = {"performance": "0.2"}
|
||||
const response = await status.getMixnodeRewardEstimatedComputation(mix_id, payload);
|
||||
|
||||
//estimation
|
||||
expect(typeof response.estimation.total_node_reward).toBe("string");
|
||||
@@ -163,4 +164,15 @@ describe("Get mixnode data", (): void => {
|
||||
|
||||
expect(typeof response.as_at).toBe("number");
|
||||
})
|
||||
|
||||
|
||||
it.skip("Post to compute mixnode reward estimation", async ():Promise<void> => {
|
||||
const mix_id = config.environmnetConfig.mixnode_identity;
|
||||
const payload = {"performance": "0.7"}
|
||||
const response = await status.getMixnodeRewardEstimatedComputation(mix_id, payload);
|
||||
|
||||
// TO-DO this test needs calculations to ensure than when passing through different performance values, the reward is also changing as expected
|
||||
expect(response.estimation.total_node_reward).toContain("986360");
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
@@ -86,21 +86,12 @@ export default class Status extends APIClient {
|
||||
}
|
||||
|
||||
public async getMixnodeRewardEstimatedComputation(
|
||||
mix_id: number
|
||||
mix_id: number,
|
||||
payload: object
|
||||
): Promise<RewardEstimation> {
|
||||
const response = await this.restClient.sendPost({
|
||||
route: `/mixnode/${mix_id}/compute-reward-estimation`,
|
||||
data: {
|
||||
"performance": "", // TO-DO add a value to this
|
||||
"active_in_rewarded_set": true,
|
||||
"pledge_amount": 0,
|
||||
"total_delegation": 0, // TO-DO grab the values from the mixnode endpoint on explorer-api and use them in this request
|
||||
"interval_operating_cost": {
|
||||
"denom": "unym",
|
||||
"amount": "3000000"
|
||||
},
|
||||
"profit_margin_percent": "" // TO-DO add a value to this
|
||||
}
|
||||
data: payload
|
||||
});
|
||||
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user