Permalink
Browse files

Added changeUrls Tests

  • Loading branch information...
RobertMCForster committed Oct 8, 2018
1 parent 23af689 commit be38a2de5bb3afa5531ae9aa1a07810fa28746be
Showing with 22 additions and 1 deletion.
  1. +22 −1 test/Investment.js
@@ -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
@@ -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 () {

0 comments on commit be38a2d

Please sign in to comment.