I have created tests that work directly with the main contract code, verifying that it works.
But now when I try to run the same tests through the proxy, it fails with “TypeError: Cannot read property ‘function call’ of undefined”.
I assume this is due to the method in question does not exist in the Proxy.sol and that the default way of running javascript tests with Truffle and Ganache need the knowledge of what your calling to work.
Just as when calling the Proxy in the wild, you use the ABI of the contract your proxying to.
Is there any way to create automated tests to verify if a proxy works as intended? I.e. by running tests through it towards the contract you want to verify work?
For testing upgradeable contracts, once you have deployed the implementation contract, the proxy contract, and initialized the upgradeable contract you can then interact with the upgradeable contract using the ABI of the implementation contract and the proxy contract address.
You won’t be able to interact from the admin address.
I recommend using Upgrades Plugins as this will check upgrade safety when you deploy and upgrade, and make it easy to deploy and test using Truffle and Buidler.