-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check points sum is consistent (#764)
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
test/suites/smoke-test-dancelight/test-external-validators-rewards.ts
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,31 @@ | ||
import { beforeAll, describeSuite, expect } from "@moonwall/cli"; | ||
import { ApiPromise } from "@polkadot/api"; | ||
|
||
describeSuite({ | ||
id: "S22", | ||
title: "Smoke tests for external validators rewards pallet", | ||
foundationMethods: "read_only", | ||
testCases: ({ it, context }) => { | ||
let api: ApiPromise; | ||
|
||
beforeAll(async () => { | ||
api = context.polkadotJs(); | ||
}); | ||
|
||
it({ | ||
id: "C01", | ||
title: "Total points matches sum of individual points", | ||
test: async function () { | ||
const entries = await api.query.externalValidatorsRewards.rewardPointsForEra.entries(); | ||
|
||
for (const [key, entry] of entries) { | ||
let sum = 0; | ||
for (const [, points] of entry.individual.entries()) { | ||
sum += points.toNumber(); | ||
} | ||
expect(sum).to.be.eq(entry.total.toNumber(), `inconsistency at key ${key}`); | ||
} | ||
}, | ||
}); | ||
}, | ||
}); |