How can I test a function returning a struct in solidity using chai in hardhat

Viewed 368

I have the following function :

function getACountry(string memory _countryISO2Code)
    external
    view
    badCountryCode(_countryISO2Code)
    mustAlreadyExist(_countryISO2Code)
    returns (Country memory) //Country is a struc of a country in the contract...
  {
    string memory isoCode = Tools.toUpperCase(_countryISO2Code);
    return countriesMap[isoCode];
  }

I want to know the most efficient way to test this code(returning a struct) in hardhat using chai. Giving it a valid country ISO2Code, I want to test if it returning the right country information if the giving country is already stored in the contract... Thanks

0 Answers
Related