sean pfp
sean
@swabbie.eth
exp. with Foundry recently, and it's cool, but I'm a bit confused as to why testing in Solidity is preferred when it's highly likely interactions w/ your contract will need to use JS/TS anyway. 3P apps call your contract directly via frontend or they have a contract that calls your contract that itself uses a frontend
5 replies
0 recast
1 reaction

Varun Srinivasan pfp
Varun Srinivasan
@v
Testing code written in one language using another language is a massive kludge (very rare that this happens, except maybe e2e tests) You introduce a lot of complexity at the boundary, translating objects from one language to another and back. That makes it hard to write good tests.
1 reply
0 recast
3 reactions

sean pfp
sean
@swabbie.eth
That makes sense, but since the goal of the contract is likely to often be called via a frontend, would it not also be wise to test via that use case? It seems poor practice to neglect an (often primary) interaction. In the past, my team has just written test contracts to test contract calls anyway, so both are tested
2 replies
0 recast
0 reaction

Varun Srinivasan pfp
Varun Srinivasan
@v
Would you test your python backend with python or JavaScript? The answer is probably that most of your unit tests and db tests will be written in python, and you may have one or two e2e browser tests that do a whole sweep over the system at a high level to make sure the frontend renders right.
0 reply
0 recast
2 reactions