Skip to content

Commit

Permalink
Adding Mapping test
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Stefanov <[email protected]>
  • Loading branch information
stefan-stefanooov committed Oct 18, 2023
1 parent 9593407 commit 5ebce11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions contracts/solidity/defaults/Defaults.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ contract Defaults {
bytes[] bytesArr;
}

mapping(string => uint) public strUintMap;
mapping(address => bool) public addrBoolMap;
mapping(int => bytes) public bytesBytesMap;

function getUintDefaults() external pure returns (UintDefaults memory) {
UintDefaults memory defaults;
return defaults;
Expand Down
10 changes: 7 additions & 3 deletions test/solidity/defaults/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ describe('Solidity Defaults', function () {
expect(res).to.equal(ethers.utils.hexZeroPad(ethers.utils.hexlify(0), 20))
})

// mapping cannot be returned from solidity
xit('confirm solidity functionality: mapping', async function () {

it('confirm solidity functionality: mapping', async function () {
const res1 = await contract.strUintMap('')
const res2 = await contract.addrBoolMap(contract.address)
const res3 = await contract.bytesBytesMap(10)
expect(res1).to.equal(ethers.BigNumber.from(0))
expect(res2).to.equal(false)
expect(res3).to.equal('0x')
})
})

0 comments on commit 5ebce11

Please sign in to comment.