I am setting up an ERC20 token ICO on the ethereum network using Solidity and Truffle.
Can anyone tell me why this is not working, I have 4 test files (as I would ideally like to keep them as short and concise as possible), one for testing the token, one for testing the set-up of the crowdsale, one for testing a successful run through (where the cap is reached) and one for testing the emergency stop functionality.
For this reason, I would like to run through multiple it() test cases which use the preceding values to test their own thing in each file i.e.
In the set-up test file:
First it() tests if the contract is deployed
Second it() tests if the contracts variables are set correctly etc.
I have then attempted to create a new instance of the token and contract on each file so that I can run through various test cases.
Each file starts with:
Token.new(initialAmount, tokenName, decimalUnits,tokenSymbol, {from: account_one});
Sale.new(softCap, hardCap, etherCostOfEachToken, account_one, token, durationInMinutes, {from: account_one});
However, when running through my tests I get the error:
AssertionError: State of contract was not 'Waiting approval': expected '4' to equal 1
at /Users/jackpickering/Desktop/Development/Capped_ICO/test/4Crowdsale_EmergencyStop_Test.js:28:14
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
The status has not been reset back to 1 after finishing the Successful crowdsale test file had ran and therefore, the Sale.new() line must not work.
Is there a better way to do this? Am I missing anything?
Thanks in advance.