Hi @abcoathup. For upgradable contracts, would you always recommend writing duplicate test files, with upgradability being the only difference between them? When should we test an upgradable contract as just a logic implementation? Thanks in advance.
Hi @dtp5,
My thoughts are to write unit tests for your logic contract with a high level of coverage.
You can then create tests specific to the upgradeable version. I don’t think you need to duplicate your logic contract tests. As well as some general tests, you should focus on any interactions that may have specific gas restrictions. (See OpenZeppelin upgradeable contracts affected by Istanbul hardfork for more details)
When you upgrade, you should have automated tests to check the upgrade and you should also test using a fork of mainnet. (see Testing real-world contract upgrades for concepts)
I’d be interested to here other community thoughts on the best way to test upgradeable contracts.
Hi @dtp5,
To set up more integration-like tests, or test an actual upgrade, you can set up the upgradeable contract using a snippet similar to the one in Upgrades library example