Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chai lengthOf matcher not compatible with ethers/waffle objects #420

Closed
ItsNickBarry opened this issue Jan 6, 2021 · 2 comments · Fixed by #423
Closed

Chai lengthOf matcher not compatible with ethers/waffle objects #420

ItsNickBarry opened this issue Jan 6, 2021 · 2 comments · Fixed by #423

Comments

@ItsNickBarry
Copy link
Contributor

ItsNickBarry commented Jan 6, 2021

let quorum = ethers.constants.One;
let signers = await ethers.getSigners();

expect(quorum).to.be.at.least(1);

expect(signers.length).to.be.at.least(quorum);
expect(signers).to.have.lengthOf.at.least(1);
expect([1]).to.have.lengthOf.at.least(quorum);
expect(signers).to.have.lengthOf.at.least(quorum);

All statements run successfully except for the last one.

The error message is not particularly helpful: AssertionError: Expected "[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" to be at least 1

Previously reported to Hardhat.

@vanruch
Copy link
Contributor

vanruch commented Jan 11, 2021

Thanks for reporting @ItsNickBarry. Until there's fix for this, you can cast expected length to normal number
expect(signers).to.have.lengthOf.at.least(quorum.toNumber())

@marekkirejczyk
Copy link
Contributor

Released in 3.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants