Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for calling into contract ABIs from unit tests (#3672)
closes #3262. # About this PR For unit tests in contracts, we are now deploying the contract before executing the tests so that we can support calling into contract ABI. With this PR testing a contract looks like: 1. Compile the contract with tests 2. Compile the contract without the tests 3. Deploy the contract (the one that we compiled without the tests) 4. Run each test as a script Currently there is no way to obtain the contract id without deploying the contract (related #3444) and automatic `CONTRACT_ID` injection is not available as we cannot inject it until we solve #3622. ~I am planning to tackle #3622 and add the documentation after that as this is not directly usable by our users until we have `CONTRACT_ID` injection or #3444.~ I changed my mind and decided to print the contract id for now so that this will be useable and because of that I will be adding the documentation with this PR. For now it the testing flow will be rough as users will need to first run `forc test` and get the contract id and manually edit their tests while setting up the tests (writing the `abi` casts). I will add some explanation of the process and point to #3673 since it will make the testing flow seamless. ## TODO - [x] Add tests - [x] Add documentation
- Loading branch information