Skip to content

Commit

Permalink
feat(tests): add balanceOfToken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickGT committed Aug 16, 2021
1 parent a56e523 commit ce936b2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/MStableYieldSource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ describe('MStableYieldSource', () => {
});
});

describe('balanceOfToken()', () => {
it('should return user balance', async () => {
const yieldSourceOwnerBalance = toWei('100');
const wallet2Balance = toWei('100');

await mUSD.connect(yieldSourceOwner).approve(mStableYieldSource.address, yieldSourceOwnerBalance);
await mStableYieldSource.connect(yieldSourceOwner).supplyTokenTo(yieldSourceOwnerBalance, yieldSourceOwner.address);

await mUSD.connect(yieldSourceOwner).transfer(wallet2.address, wallet2Balance);

await mUSD.connect(wallet2).approve(mStableYieldSource.address, wallet2Balance);
await mStableYieldSource.connect(wallet2).supplyTokenTo(wallet2Balance, wallet2.address);

expect(await mStableYieldSource.balanceOfToken(yieldSourceOwner.address)).to.equal(yieldSourceOwnerBalance);
expect(await mStableYieldSource.balanceOfToken(wallet2.address)).to.equal(wallet2Balance);
});
});

describe('redeemToken()', () => {
let yieldSourceOwnerBalance: BigNumber;
let redeemAmount: BigNumber;
Expand Down

0 comments on commit ce936b2

Please sign in to comment.