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:
parent
64d62726ff
commit
dafbb1a6ce
@ -350,7 +350,7 @@ export class OceanFixedRateExchange {
|
|||||||
if (constituents.active === true && constituents.dataToken === dataTokenAddress) {
|
if (constituents.active === true && constituents.dataToken === dataTokenAddress) {
|
||||||
const supply = new BigNumber(await this.getSupply(constituents.exchangeID))
|
const supply = new BigNumber(await this.getSupply(constituents.exchangeID))
|
||||||
const required = new BigNumber(minSupply)
|
const required = new BigNumber(minSupply)
|
||||||
if (supply >= required) {
|
if (supply.gte(required)){
|
||||||
result.push(constituents)
|
result.push(constituents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,7 @@ describe('FixedRateExchange flow', () => {
|
|||||||
it('Bob should find the exchange', async () => {
|
it('Bob should find the exchange', async () => {
|
||||||
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, '0')
|
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, '0')
|
||||||
assert(exchangeDetails[0].exchangeID === aliceExchangeId)
|
assert(exchangeDetails[0].exchangeID === aliceExchangeId)
|
||||||
|
assert(exchangeDetails.length === 1)
|
||||||
})
|
})
|
||||||
it('Bob should get the exchange details', async () => {
|
it('Bob should get the exchange details', async () => {
|
||||||
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
||||||
@ -221,4 +222,8 @@ describe('FixedRateExchange flow', () => {
|
|||||||
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
const exchangeDetails = await FixedRateClass.getExchange(aliceExchangeId)
|
||||||
assert(exchangeDetails.active === true)
|
assert(exchangeDetails.active === true)
|
||||||
})
|
})
|
||||||
|
it('Bob should not find the exchange', async () => {
|
||||||
|
const exchangeDetails = await FixedRateClass.searchforDT(tokenAddress, tokenAmount)
|
||||||
|
assert(exchangeDetails.length === 0)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user