Skip to content

Commit

Permalink
bigz/fix-ts-tests-2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbigz committed Oct 18, 2023
1 parent 25302eb commit 633ee84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test-scripts/single-anchor-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [ "$1" != "--skip-build" ]
cp target/idl/drift.json sdk/src/idl/
fi

test_files=(liquidityProvider.ts)
test_files=(liquidateSpotSocialLoss.ts)

for test_file in ${test_files[@]}; do
ANCHOR_TEST_FILE=${test_file} anchor test --skip-build || exit 1;
Expand Down
10 changes: 7 additions & 3 deletions tests/liquidateSpotSocialLoss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,25 @@ describe('liquidate spot w/ social loss', () => {
)
);

const depositAmountBefore = getTokenAmount(
const dep1 = getTokenAmount(
spotMarket1Before.depositBalance,
spotMarket1Before,
SpotBalanceType.DEPOSIT
).sub(borrowDecrease);
);
const depositAmountBefore = dep1.sub(borrowDecrease);

const currentDepositAmount = getTokenAmount(
spotMarket1.depositBalance,
spotMarket1,
SpotBalanceType.DEPOSIT
);
console.log(currentDepositAmount.toString(), depositAmountBefore.toString(), '(', dep1.toString(), ')');

const interestOfUpdate = currentDepositAmount.sub(depositAmountBefore);
console.log('interestOfUpdate:', interestOfUpdate.toString());
assert(interestOfUpdate.eq(ZERO));
assert(interestOfUpdate.lte(ZERO));
assert(interestOfUpdate.gte(new BN(-1)));

});

it('resolve bankruptcy', async () => {
Expand Down

0 comments on commit 633ee84

Please sign in to comment.