MCPcopy Create free account
hub / github.com/api3dao/airnode / assertArrayEquals

Function assertArrayEquals

packages/airnode-adapter/e2e/index.ts:9–19  ·  view source on GitHub ↗
(actual: T, expected: T)

Source from the content-addressed store, hash-verified

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[])"
9function 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
21it('shows the need for assertArrayEquals', () => {
22 expect(ethers.BigNumber.from(123)).to.equal(123);

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected