Open ItsNickBarry opened 1 year ago
hi @ItsNickBarry! This is currently not supported. We'll take it as a feature request. Reproduction example:
// contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract MyERC1155 is ERC1155 {
constructor() ERC1155("") {
// Mint some tokens for testing
uint256 tokenId = 0;
uint256 initialSupply = 0;
_mint(msg.sender, tokenId, initialSupply, "");
}
}
// test file
import { expect } from "chai";
import { ethers } from "hardhat";
describe("MyERC1155", function () {
async function deployMyERC1155() {
const [holder] = await ethers.getSigners();
const MyERC1155 = await ethers.getContractFactory("MyERC1155");
const myERC1155 = await MyERC1155.deploy();
return { holder, instance: myERC1155 };
}
it("returns the balances of given tokens held by given addresses", async function () {
const { holder, instance } = await deployMyERC1155();
const balances = await instance.balanceOfBatch.staticCall(
[holder.address],
[0n]
);
// doesn't work
expect(balances).to.have.deep.members([0n]);
// works
// expect(Array.from(balances)).to.have.deep.members([0n]);
});
});
Describe the feature
When using Ethers v6, the Chai matchers plugin does not seem to support checking the contents of arrays using the
members
matcher.This fails:
This works:
Reproducible here: https://github.com/solidstate-network/solidstate-solidity/blob/494b278e75561da8b5b9010838bf517d2443ee66/spec/token/ERC1155/ERC1155Base.behavior.ts#L87-L92
Search terms
chai members matchers