| 7 | // Chai is able to assert that "expect(BigNumber).to.equal(string)" but fails to assert |
| 8 | // the values if wrapped in array "expect(BigNumber[]).to.equal(string[])" |
| 9 | function assertArrayEquals<T = unknown>(actual: T, expected: T) { |
| 10 | if (!Array.isArray(actual)) { |
| 11 | expect(actual).to.equal(expected); |
| 12 | return; |
| 13 | } |
| 14 | |
| 15 | // eslint-disable-next-line |
| 16 | for (let i = 0; i < actual.length; i++) { |
| 17 | assertArrayEquals(actual[i], (expected as any)[i]); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | it('shows the need for assertArrayEquals', () => { |
| 22 | expect(ethers.BigNumber.from(123)).to.equal(123); |