Skip to content

Commit 1e060a1

Browse files
committed
fix: deps and markets.test.ts
1 parent 8753c89 commit 1e060a1

File tree

5 files changed

+722
-116
lines changed

5 files changed

+722
-116
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Given the Aave client > When using the 'chains(client)' action > Then it should return the supported chains 1`] = `
4+
[
5+
{
6+
"__typename": "Chain",
7+
"chainId": 1,
8+
"icon": "https://statics.aave.com/ethereum.svg",
9+
"name": "Ethereum",
10+
},
11+
{
12+
"__typename": "Chain",
13+
"chainId": 42161,
14+
"icon": "https://statics.aave.com/arbitrum.svg",
15+
"name": "Arbitrum",
16+
},
17+
{
18+
"__typename": "Chain",
19+
"chainId": 43114,
20+
"icon": "https://statics.aave.com/avalanche.svg",
21+
"name": "Avalanche",
22+
},
23+
{
24+
"__typename": "Chain",
25+
"chainId": 8453,
26+
"icon": "https://statics.aave.com/base.svg",
27+
"name": "Base",
28+
},
29+
{
30+
"__typename": "Chain",
31+
"chainId": 56,
32+
"icon": "https://statics.aave.com/bnbchain.svg",
33+
"name": "BSC",
34+
},
35+
{
36+
"__typename": "Chain",
37+
"chainId": 42220,
38+
"icon": "https://statics.aave.com/celo.svg",
39+
"name": "Celo",
40+
},
41+
{
42+
"__typename": "Chain",
43+
"chainId": 100,
44+
"icon": "https://statics.aave.com/Gnosis.svg",
45+
"name": "Gnosis",
46+
},
47+
{
48+
"__typename": "Chain",
49+
"chainId": 59144,
50+
"icon": "https://statics.aave.com/linea.svg",
51+
"name": "Linea",
52+
},
53+
{
54+
"__typename": "Chain",
55+
"chainId": 1088,
56+
"icon": "https://statics.aave.com/Metis.svg",
57+
"name": "Metis",
58+
},
59+
{
60+
"__typename": "Chain",
61+
"chainId": 10,
62+
"icon": "https://statics.aave.com/optimism.svg",
63+
"name": "Optimism",
64+
},
65+
{
66+
"__typename": "Chain",
67+
"chainId": 137,
68+
"icon": "https://statics.aave.com/polygon.svg",
69+
"name": "Polygon",
70+
},
71+
{
72+
"__typename": "Chain",
73+
"chainId": 534352,
74+
"icon": "https://statics.aave.com/scroll-network.svg",
75+
"name": "Scroll",
76+
},
77+
{
78+
"__typename": "Chain",
79+
"chainId": 1946,
80+
"icon": "https://statics.aave.com/soneium.svg",
81+
"name": "Soneium",
82+
},
83+
{
84+
"__typename": "Chain",
85+
"chainId": 146,
86+
"icon": "https://statics.aave.com/sonic.svg",
87+
"name": "Sonic",
88+
},
89+
{
90+
"__typename": "Chain",
91+
"chainId": 324,
92+
"icon": "https://statics.aave.com/zksync-era-light.svg",
93+
"name": "zkSync",
94+
},
95+
{
96+
"__typename": "Chain",
97+
"chainId": 324,
98+
"icon": "https://statics.aave.com/zksync-era-light.svg",
99+
"name": "zkSync",
100+
},
101+
{
102+
"__typename": "Chain",
103+
"chainId": 5000,
104+
"icon": "https://statics.aave.com/mantle.svg",
105+
"name": "Mantle",
106+
},
107+
]
108+
`;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Given the Aave Protocol v3 > When fetching markets data > Then it should be possible to fetch markets for a given chain ID 1`] = `
4+
{
5+
"__typename": "Market",
6+
"address": "0x0AA97c284e98396202b6A04024F5E2c65026F3c0",
7+
"borrowReserves": Any<Array>,
8+
"chain": {
9+
"__typename": "Chain",
10+
"chainId": 99999999,
11+
"icon": "https://statics.aave.com/ethereum.svg",
12+
"name": "ForkedEthereum",
13+
},
14+
"eModeCategories": Any<Array>,
15+
"icon": "https://statics.aave.com/ethereum.svg",
16+
"name": "AaveV3EthereumForkedEtherFi",
17+
"supplyReserves": Any<Array>,
18+
"totalAvailableLiquidity": "583285.41725508467783710208869",
19+
"totalMarketSize": Any<String>,
20+
"userState": null,
21+
}
22+
`;
23+
24+
exports[`Given the Aave Protocol v3 > When fetching markets data > Then it should be possible to fetch markets for a given chain ID 2`] = `
25+
{
26+
"__typename": "Market",
27+
"address": "0x4e033931ad43597d96D6bcc25c280717730B58B1",
28+
"borrowReserves": Any<Array>,
29+
"chain": {
30+
"__typename": "Chain",
31+
"chainId": 99999999,
32+
"icon": "https://statics.aave.com/ethereum.svg",
33+
"name": "ForkedEthereum",
34+
},
35+
"eModeCategories": Any<Array>,
36+
"icon": "https://statics.aave.com/ethereum.svg",
37+
"name": "AaveV3EthereumForkedLido",
38+
"supplyReserves": Any<Array>,
39+
"totalAvailableLiquidity": "801504840.4207857115463943922",
40+
"totalMarketSize": Any<String>,
41+
"userState": null,
42+
}
43+
`;
44+
45+
exports[`Given the Aave Protocol v3 > When fetching markets data > Then it should be possible to fetch markets for a given chain ID 3`] = `
46+
{
47+
"__typename": "Market",
48+
"address": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
49+
"borrowReserves": Any<Array>,
50+
"chain": {
51+
"__typename": "Chain",
52+
"chainId": 99999999,
53+
"icon": "https://statics.aave.com/ethereum.svg",
54+
"name": "ForkedEthereum",
55+
},
56+
"eModeCategories": Any<Array>,
57+
"icon": "https://statics.aave.com/ethereum.svg",
58+
"name": "AaveV3ForkedEthereum",
59+
"supplyReserves": Any<Array>,
60+
"totalAvailableLiquidity": "21235993152.103032104308741052",
61+
"totalMarketSize": Any<String>,
62+
"userState": null,
63+
}
64+
`;

packages/client/src/actions/chains.test.ts

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -4,116 +4,11 @@ import { client } from '@aave/client/test-utils';
44
import { describe, expect, it } from 'vitest';
55

66
describe('Given the Aave client', () => {
7-
describe(`when using the 'chains(client)' action`, () => {
8-
it('then it should return the supported chains', async () => {
7+
describe(`When using the 'chains(client)' action`, () => {
8+
it('Then it should return the supported chains', async () => {
99
const result = await chains(client);
1010
assertOk(result);
11-
expect(result.value).toMatchInlineSnapshot(`
12-
[
13-
{
14-
"__typename": "Chain",
15-
"chainId": 1,
16-
"icon": "https://statics.aave.com/ethereum.svg",
17-
"name": "Ethereum",
18-
},
19-
{
20-
"__typename": "Chain",
21-
"chainId": 42161,
22-
"icon": "https://statics.aave.com/arbitrum.svg",
23-
"name": "Arbitrum",
24-
},
25-
{
26-
"__typename": "Chain",
27-
"chainId": 43114,
28-
"icon": "https://statics.aave.com/avalanche.svg",
29-
"name": "Avalanche",
30-
},
31-
{
32-
"__typename": "Chain",
33-
"chainId": 8453,
34-
"icon": "https://statics.aave.com/base.svg",
35-
"name": "Base",
36-
},
37-
{
38-
"__typename": "Chain",
39-
"chainId": 56,
40-
"icon": "https://statics.aave.com/bnbchain.svg",
41-
"name": "BSC",
42-
},
43-
{
44-
"__typename": "Chain",
45-
"chainId": 42220,
46-
"icon": "https://statics.aave.com/celo.svg",
47-
"name": "Celo",
48-
},
49-
{
50-
"__typename": "Chain",
51-
"chainId": 100,
52-
"icon": "https://statics.aave.com/Gnosis.svg",
53-
"name": "Gnosis",
54-
},
55-
{
56-
"__typename": "Chain",
57-
"chainId": 59144,
58-
"icon": "https://statics.aave.com/linea.svg",
59-
"name": "Linea",
60-
},
61-
{
62-
"__typename": "Chain",
63-
"chainId": 1088,
64-
"icon": "https://statics.aave.com/Metis.svg",
65-
"name": "Metis",
66-
},
67-
{
68-
"__typename": "Chain",
69-
"chainId": 10,
70-
"icon": "https://statics.aave.com/optimism.svg",
71-
"name": "Optimism",
72-
},
73-
{
74-
"__typename": "Chain",
75-
"chainId": 137,
76-
"icon": "https://statics.aave.com/polygon.svg",
77-
"name": "Polygon",
78-
},
79-
{
80-
"__typename": "Chain",
81-
"chainId": 534352,
82-
"icon": "https://statics.aave.com/scroll-network.svg",
83-
"name": "Scroll",
84-
},
85-
{
86-
"__typename": "Chain",
87-
"chainId": 1946,
88-
"icon": "https://statics.aave.com/soneium.svg",
89-
"name": "Soneium",
90-
},
91-
{
92-
"__typename": "Chain",
93-
"chainId": 146,
94-
"icon": "https://statics.aave.com/sonic.svg",
95-
"name": "Sonic",
96-
},
97-
{
98-
"__typename": "Chain",
99-
"chainId": 324,
100-
"icon": "https://statics.aave.com/zksync-era-light.svg",
101-
"name": "zkSync",
102-
},
103-
{
104-
"__typename": "Chain",
105-
"chainId": 324,
106-
"icon": "https://statics.aave.com/zksync-era-light.svg",
107-
"name": "zkSync",
108-
},
109-
{
110-
"__typename": "Chain",
111-
"chainId": 5000,
112-
"icon": "https://statics.aave.com/mantle.svg",
113-
"name": "Mantle",
114-
},
115-
]
116-
`);
11+
expect(result.value).toMatchSnapshot();
11712
});
11813
});
11914
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { assertOk } from '@aave/types';
2+
import { describe, expect, it } from 'vitest';
3+
import { client, ETHEREUM_FORK_ID } from '../test-utils';
4+
import { markets } from './markets';
5+
6+
describe('Given the Aave Protocol v3', () => {
7+
describe('When fetching markets data', () => {
8+
it('Then it should be possible to fetch markets for a given chain ID', async () => {
9+
const result = await markets(client, {
10+
chainIds: [ETHEREUM_FORK_ID],
11+
});
12+
13+
assertOk(result);
14+
15+
result.value.forEach((market) => {
16+
expect(market).toMatchSnapshot({
17+
totalMarketSize: expect.any(String),
18+
borrowReserves: expect.any(Array),
19+
supplyReserves: expect.any(Array),
20+
eModeCategories: expect.any(Array),
21+
});
22+
});
23+
});
24+
});
25+
});

0 commit comments

Comments
 (0)