Skip to content

Commit

Permalink
test: add extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Nov 13, 2024
1 parent 07d1cde commit 536b329
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describeSuite({
testCases: ({ it, context, log }) => {
let testCounter = 0;

let testCases: TestCase[] = [
const testCases: TestCase[] = [
{
proportion: new Perbill(0),
transfer_amount: 10n * UNIT,
Expand Down Expand Up @@ -75,11 +75,11 @@ describeSuite({
const burnPercentage = burnProportion.value().toNumber() / 1e7;

const calcTreasuryIncrease = (feeWithTip: bigint): bigint => {
let val = t.proportion.of(new BN(feeWithTip));
const val = t.proportion.of(new BN(feeWithTip));
return BigInt(val.toString());
};
const calcIssuanceDecrease = (feeWithTip: bigint): bigint => {
let val = burnProportion.of(new BN(feeWithTip));
const val = burnProportion.of(new BN(feeWithTip));
return BigInt(val.toString());
};

Expand Down Expand Up @@ -121,6 +121,11 @@ describeSuite({
const issuanceDecrease = issuanceBefore - issuanceAfter;
const fee = extractFee(result?.events)!.amount.toBigInt();

expect(
treasuryIncrease + issuanceDecrease,
`Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees`
).to.equal(fee);

expect(
treasuryIncrease,
`${treasuryPercentage}% of the fees should go to treasury`
Expand Down Expand Up @@ -176,6 +181,11 @@ describeSuite({
const issuanceDecrease = issuanceBefore - issuanceAfter;
const fee = extractFee(result?.events)!.amount.toBigInt();

expect(
treasuryIncrease + issuanceDecrease,
`Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees`
).to.equal(fee);

expect(
treasuryIncrease,
`${treasuryPercentage}% of the fees should go to treasury`
Expand Down

0 comments on commit 536b329

Please sign in to comment.