1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

add more unit tests

This commit is contained in:
alexcos20 2020-09-10 06:46:01 -07:00
parent 64d62726ff
commit dafbb1a6ce
2 changed files with 6 additions and 1 deletions

View File

@ -350,7 +350,7 @@ export class OceanFixedRateExchange {
if (constituents.active === true && constituents.dataToken === dataTokenAddress) {
const supply = new BigNumber(await this.getSupply(constituents.exchangeID))
const required = new BigNumber(minSupply)
if (supply >= required) {
if (supply.gte(required)){
result.push(constituents)
}
}

View File

@ -173,6 +173,7 @@ describe('FixedRateExchange flow', () => {
it('Bob should find the exchange', async () => {
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, '0')
assert(exchangeDetails[0].exchangeID === aliceExchangeId)
assert(exchangeDetails.length === 1)
})
it('Bob should get the exchange details', async () => {
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
@ -221,4 +222,8 @@ describe('FixedRateExchange flow', () => {
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
assert(exchangeDetails.active === true)
})
it('Bob should not find the exchange', async () => {
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, tokenAmount)
assert(exchangeDetails.length === 0)
})
})