Skip to main content
added chai tag
Link
Source Link

How to assert that a BigNumber is included in a list of numbers?

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?