Truffle injects the list of accounts available from the node you’re connected to. From the Truffle docs:
The contract() function provides a list of accounts made available by your Ethereum client which you can use to write tests.
To use these accounts, you write your test case like this:
contract(‘MyContract’, function(accounts) {
it(‘test1’, function() {
const account = accounts[0];
// do something with account
}
});
accounts
is just an array. The code from OpenZeppelin you posted is expecting there to be at least 5 accounts available in the node (the same array of accounts are available via web3.eth.getAccounts()
). They are just decomposing the array into specific variable names. _
is accounts[0]
, wallet
is accounts[1]
, etc. You can name them whatever you want.