Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
950 B
1
Indexable
Never
// SMART CONTRACT FUNCTION
function addAllowance(address _who, uint _amount) public onlyOwner {
    allowance[_who] = _amount;
    emit AllowanceChanged(_who, msg.sender, allowance[_who], _amount);
}


// TEST CODE
const FamilyWallet = artifacts.require("FamilyWallet")

const toBN = value => web3.utils.toBN(value)


contract("FamilyWallet", accounts => {

    const _amount = "2000000000000000000";
  
    let _contract = null
    let contractOwner = null
    let _who = null

    before(async() => {

      _contract = await FamilyWallet.deployed()
      contractOwner = accounts[0]
      _who = accounts[1]
    })

    describe("Adding Allowance", () => {

      before (async() => {
        const result = await _contract.addAllowance({
        to: _who.address, 
        _amount
        })
        console.log(result)
      })
      
      it("should resolve into true value", () =>{
          assert(true, "test is passing")
      })
    })
})