Skip to content

Commit dc3152d

Browse files
authored
Fix view-function-multi-chain test (#3875)
1 parent eb8b2a9 commit dc3152d

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Compile tests
7474
env:
7575
CHANGED_PACKAGES: ${{ needs.install-packages.outputs.changed-packages }}
76-
FAILING_TESTS_PATTERN: '/composites/dydx-rewards/|/composites/glv-token/|/composites/gm-token/|/core/bootstrap/|/sources/bitgo-reserves-test/|/sources/bitgo-reserves/|/sources/coinpaprika/|/sources/cryptocompare/|/sources/icap/|/sources/ipfs/|/sources/layer2-sequencer-health/|/sources/s3-csv-reader/|sources/view-function/|/k6/|/observation/'
76+
FAILING_TESTS_PATTERN: '/composites/dydx-rewards/|/composites/glv-token/|/composites/gm-token/|/core/bootstrap/|/sources/bitgo-reserves-test/|/sources/bitgo-reserves/|/sources/coinpaprika/|/sources/cryptocompare/|/sources/icap/|/sources/ipfs/|/sources/layer2-sequencer-health/|/sources/s3-csv-reader/|/k6/|/observation/'
7777
run: |
7878
echo "Tests that should compile:"
7979
configs_to_compile=($(echo "$CHANGED_PACKAGES" | jq '.[].location + "/tsconfig.test.json"' -r | grep -v -E "$FAILING_TESTS_PATTERN" || true))

packages/sources/view-function/test/integration/__snapshots__/adapter.test.ts.snap

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`execute function endpoint should return error for invalid input 1`] = `
4-
{
5-
"errorMessage": "no matching function (argument="key", value="symbol() view returns (string)", code=INVALID_ARGUMENT, version=6.13.5)",
6-
"statusCode": 502,
7-
"timestamps": {
8-
"providerDataReceivedUnixMs": 0,
9-
"providerDataRequestedUnixMs": 0,
10-
},
11-
}
12-
`;
13-
143
exports[`execute function endpoint should return success 1`] = `
154
{
165
"data": {

packages/sources/view-function/test/integration/adapter.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ describe('execute', () => {
7373
}
7474
const response = await testAdapter.request(data)
7575
expect(response.statusCode).toBe(502)
76-
expect(response.json()).toMatchSnapshot()
76+
expect(response.json()).toEqual({
77+
errorMessage: expect.stringMatching(
78+
/no matching function \(argument="key", value="symbol\(\) view returns \(string\)", code=INVALID_ARGUMENT, version=/,
79+
),
80+
statusCode: 502,
81+
timestamps: { providerDataReceivedUnixMs: 0, providerDataRequestedUnixMs: 0 },
82+
})
7783
})
7884
})
7985
})

packages/sources/view-function/test/integration/fixtures.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import nock from 'nock'
33
type JsonRpcPayload = {
44
id: number
55
method: string
6-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7-
params: Array<any> | Record<string, any>
6+
params: {
7+
to: string
8+
data: string
9+
}[]
810
jsonrpc: '2.0'
911
}
1012

@@ -16,7 +18,7 @@ export const mockContractCallResponseSuccess = (): nock.Scope =>
1618
.post('/', (body: any) => Array.isArray(body))
1719
.reply(
1820
200,
19-
(uri, requestBody: any[]) => {
21+
(_uri, requestBody: any[]) => {
2022
return requestBody.map((request: JsonRpcPayload) => {
2123
if (request.method === 'eth_chainId') {
2224
return {

0 commit comments

Comments
 (0)