How to test payable functions with OpenZeppelin Testing Environment?

So, I have written a crowd-sale using Open-zeppelin. And I am writing tests using OpenZeppelin’s testing enviroment. It’s has been great so far. What I am trying to do now is testing “buyTokens” function (and some other but I need to call that to test those other things). Do we have any examples on how to test payable functions. I am also using test-helpers if it helps(pun intended :wink:)

1 Like

I think you should add the parameter value: xxx such as:

it('should accept payments', async function () {
    await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
});
1 Like