0

I am trying to assert a uint256 the following way:

            expect(tokenType).to.be.oneOf([1, 2, 3, 4]);

I just want to check that its value is any of the ones on that list, as I am using a randomisation to get it and I want to check that it is working properly.

The problem I have is that I am getting this error:

AssertionError: expected BigNumber { value: "3" } to be one of [ 1, 2, 3, 4 ]

What am I doing wrong?

1 Answer 1

0

Based on chai documentation, oneOf assertion does not work with BigNumber.

I had to replace that assertion with greaterThan and lessThan:

expect(tokenType).to.be.greaterThan(BigNumber.from(0)).and.lessThan(BigNumber.from(5));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.