I want to specify the address I perform a transaction with in my truffle test.
My test looks approximately like this:
contract('Test contract', async (accounts) => {
let contract;
before(async () => {
contract = await Contract.new();
});
it("Check something...", async () => {
await studentV1.addPerson("Jon", "Doe");
await studentV1.addPerson("Max", "Musterman");
//....
});
});
The contract methode addPerson(...)
works approximately like this:
function addPerson(string _firstname, string _lastname) public {
persons[msg.sender] = Person(_firstname, _lastname);
}
Now I want to call my test at await studentV1.addPerson("Jon", "Doe");
with account[0]
and the line below with account[1]
so my map will also get two different entries. How can I do this? By default truffle test uses for each transaction and call accounts[0]
.
Im working with the truffle develop
chain which automatically creates 10 accounts on startup.