How to create/add an account to truffle test environment

Viewed 560

I'm writing test for my solidity project. Using Truffle @5.3.5. So when running truffle test It generates 10 accounts with 100 ETH (I believe it runs with ganache in the background).

The problem lies with I need an account that starts with 0 ETH. I have looked through the docs and haven't seen a solution to this.

I have tried using the ethers library to generate a new wallet. but it the test node doesn't recognize address (rather it doesn't know the private key for that address).

Is there a way to do this within the truffle testing environment.

contract("TreasuryContract", ([ treasurer, managerRewardAddress, employeeRewardAddress ]) => 
    {...})

The test itself isn't really relative to the question but the above is the method I'm using to get the accounts. (this all works fine).

I was just hoping for an easy way to have an account that the test recognizes that start with 0 ETH

1 Answers

In Ganache configuration, accounts & keys, you can change de account default balance and put it in 0.

Bests

Related