Mocking return values is the same, if it's a complex object like arrays or structs or a primitive type. The short answer is you can mock it like this
For userInfo it's a nested map. Nested maps in solidity create a getter functions that have N parameters where N is the number of maps nested. The final return from your getter is
The longer answer is Solidity creates getter functions for maps. Each of these functions has N parameters, where N is the number of maps in storage. If you take a look at the ABI for the Farm contract userInfo has two params.
Thanks and great question!
Mocking return values is the same, if it's a complex object like arrays or structs or a primitive type. The short answer is you can mock it like this
For
userInfoit's a nested map. Nested maps in solidity create a getter functions that have N parameters where N is the number of maps nested. The final return from your getter isThe longer answer is Solidity creates getter functions for maps. Each of these functions has N parameters, where N is the number of maps in storage. If you take a look at the ABI for the
FarmcontractuserInfohas two params.This represents a solidity interface
You can mock the
userInfofunction to return based on specific parameters or have a single general return value.Deeper info can be found in their docs smock.readthedocs.io/en/latest/fak...