Skip to content

Commit

Permalink
Dynamically get payment info amount for test
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbogle committed Jan 3, 2023
1 parent b7a66d7 commit fc5083e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/reward-distribution/claim-rewards-sol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import {
getAssociatedTokenAddressSync,
} from "@solana/spl-token";
import type { PublicKey } from "@solana/web3.js";
import {
Keypair,
LAMPORTS_PER_SOL,
SystemProgram,
Transaction,
} from "@solana/web3.js";
import { Keypair, SystemProgram, Transaction } from "@solana/web3.js";
import { BN } from "bn.js";

import {
Expand Down Expand Up @@ -43,8 +38,6 @@ const REWARD_AMOUNT = 2;
let mintId: PublicKey;
let rewardMintId: PublicKey;

const PAYMENT_AMOUNT = 0.005 * LAMPORTS_PER_SOL;

beforeAll(async () => {
provider = await getProvider();
const mintKeypair = Keypair.generate();
Expand Down Expand Up @@ -346,5 +339,12 @@ test("Claim rewards", async () => {
const balanceAfter = await provider.connection.getBalance(
provider.wallet.publicKey
);
expect(balanceBefore - PAYMENT_AMOUNT).toBeGreaterThan(balanceAfter);
const defaultPaymentInfo = await fetchIdlAccount(
provider.connection,
DEFAULT_PAYMENT_INFO,
"paymentInfo"
);
expect(balanceBefore - balanceAfter).toBeGreaterThan(
defaultPaymentInfo.parsed.paymentAmount.toNumber()
);
});

0 comments on commit fc5083e

Please sign in to comment.