lets say i have this code (taken from here)

// Specifically request an abstraction for MetaCoin
var MetaCoin = artifacts.require("MetaCoin");

contract('MetaCoin', function(accounts) {
it("should put 10000 MetaCoin in the first account", function() {
  return MetaCoin.deployed().then(function(instance) {
    return instance.getBalance.call(accounts[0]);

where do i config the "accounts" param - i couldnt find a clear definition anywhere - 10x


As the Truffle documentation explains:

The contract() function provides a list of available accounts as a second parameter with which you can write tests against.

You don't have to config the accounts params. If you are testing the contract in testrpc, the accounts passed will be those that got generated in testrpc.

| improve this answer | |
  • what about all other params i wanna add? owner and whatever i can think of... – gor Oct 25 '17 at 11:56
  • ok, afaik you can declare general "accounts" array, or declare different aliases for the accounts you defined (or got by default) in your test rpc (of some kind) – gor Oct 31 '17 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.