From e1c011163644954cb6ad7b624c980907b65ca55c Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Mon, 12 Oct 2020 23:44:16 -0700 Subject: [PATCH] add more tests --- test/unit/balancer/Balancer.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/unit/balancer/Balancer.test.ts b/test/unit/balancer/Balancer.test.ts index 124e6a58..d5208885 100644 --- a/test/unit/balancer/Balancer.test.ts +++ b/test/unit/balancer/Balancer.test.ts @@ -171,6 +171,10 @@ describe('Balancer flow', () => { const requiredOcean = await Pool.getOceanNeeded(alicePoolAddress, '1') assert(Number(requiredOcean) > 0) }) + it('Get amount of DT needed to buy 1 Ocean', async () => { + const requiredOcean = await Pool.getDTNeeded(alicePoolAddress, '1') + assert(Number(requiredOcean) > 0) + }) it('Bob should search for pools with this DT', async () => { const pools = await Pool.searchPoolforDT(tokenAddress) @@ -379,6 +383,18 @@ describe('Balancer flow', () => { assert(parseFloat(poolShares) > parseFloat(newpoolShares)) }) + it('ALice should remove all liquidity', async () => { + const aliceShares = await Pool.sharesBalance(alice, greatPool) + const aliceDtBalance = await datatoken.balance(tokenAddress, alice) + const aliceOceanBalance = await datatoken.balance(oceanTokenAddress, alice) + await Pool.removePoolLiquidity(alice, greatPool, aliceShares) + const newAliceDtBalance = await datatoken.balance(tokenAddress, alice) + const newAliceOceanBalance = await datatoken.balance(oceanTokenAddress, alice) + const newAliceShares = await Pool.sharesBalance(alice, greatPool) + assert(parseFloat(aliceDtBalance) < parseFloat(newAliceDtBalance)) + assert(parseFloat(aliceOceanBalance) < parseFloat(newAliceOceanBalance)) + assert(parseFloat(aliceShares) > parseFloat(newAliceShares)) + }) it('ALice should get all the pools that she created', async () => { const alicePools = await Pool.getPoolsbyCreator(alice) assert(alicePools.length > 0)