Skip to content

Commit

Permalink
Added changeUrls Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertMCForster committed Oct 8, 2018
1 parent 23af689 commit be38a2d
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/Investment.js
Expand Up @@ -161,7 +161,7 @@ contract('Investment', function ([_, wallet]) {
})

it('should fail on non-admin payment to fallback', async function () {
await this.investment.sendTransaction({to:this.investment.address,value:toEther(2),from:this.accountTwo}).should.be.rejectedWith(EVMRevert);
await this.investment.sendTransaction({to:this.investment.address,value:toEther(2),from:this.accountTwo}).should.be.rejectedWith(EVMRevert)
})

// Gonna do Ownable.sol checks here as well
Expand Down Expand Up @@ -198,6 +198,27 @@ contract('Investment', function ([_, wallet]) {
cashInv.should.be.bignumber.equal(3)
})


it('should be able to change coin and cash API URLs', async function () {
let coinUrl = await this.investment.coinUrl()
let cashUrl = await this.investment.cashUrl()

coinUrl.should.be.equal("https://min-api.cryptocompare.com/data/pricemulti?fsyms=COIN,")
cashUrl.should.be.equal("https://min-api.cryptocompare.com/data/pricemulti?fsyms=CASH,")

await this.investment.changeUrls("https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCOIN,","https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCASH,", {from:this.owner})

let newCoinUrl = await this.investment.coinUrl()
let newCashUrl = await this.investment.cashUrl()

newCoinUrl.should.be.equal("https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCOIN,")
newCashUrl.should.be.equal("https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCASH,")
})

it('should fail on URL change by non-owner', async function () {
await this.investment.changeUrls("https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCOIN,","https://min-api.cryptocompare.com/data/pricemulti?fsyms=NOTCASH,", {from:this.accountTwo}).should.be.rejectedWith(EVMRevert)
})

})

describe('buy', function () {
Expand Down

0 comments on commit be38a2d

Please sign in to comment.