I'm a beginner with Solidity, and I'm working on a smart contract that mints an NFT and stores relevant information inside a struct. The issue I'm currently facing is that when testing the fetchMarketItems() function, which is supposed to return an array of structs, I encounter the following error with the current implementation.
TypeError: Type struct NFTMarketplace.MarketItem[] memory is not implicitly convertible to expected type struct ContractTest.MarketItem[] memory.
The function to test
function testfetchMarketItems() public returns(MarketItem[] memory) {
testCreateToken(); // test function to create tokens and it's passed
MarketItem[] memory items = propertyRecorder.fetchMarketItems();
// console2.log("Return Items", items[1]);
}
Can you propose any solution on how to implement the same return type with the testfetchMarketItems() function in Foundry as it is in the smart contract? Also, how to compare that the function output is the same as it was expected? This the contracts that I'm trying to test https://github.com/dabit3/polygon-ethereum-nextjs-marketplace/blob/main/contracts/NFTMarketplace.sol Thanks!