Skip to content

Commit c5bbb37

Browse files
committed
test: add tests for vault and reserve entities
1 parent 0970e1f commit c5bbb37

File tree

1 file changed

+119
-3
lines changed

1 file changed

+119
-3
lines changed

src/test/mappingHandlers.test.ts

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
/** @file test against agoric-3-proposals:latest */
22
import { subqlTest } from '@subql/testing';
3-
import { StateChangeEvent, Wallet } from '../types';
3+
import {
4+
ReserveAllocationMetrics,
5+
ReserveAllocationMetricsDaily,
6+
ReserveMetrics,
7+
StateChangeEvent,
8+
Vault,
9+
VaultManagerGovernance,
10+
VaultManagerMetrics,
11+
VaultManagerMetricsDaily,
12+
VaultStatesDaily,
13+
Wallet,
14+
} from '../types';
415

516
// FIXME observed in A3P:latest but not passing tests
617
subqlTest(
718
'StateChangeEvent in state_change at block 627',
8-
627, // block height to process
9-
// dependent entities
19+
627,
1020
[],
1121
[
1222
new Wallet(
@@ -29,3 +39,109 @@ subqlTest(
2939

3040
'handleStateChangeEvent',
3141
);
42+
43+
subqlTest(
44+
'Vault and VaultStateDailies at height 742',
45+
742,
46+
[],
47+
[
48+
new Vault(
49+
'published.vaultFactory.managers.manager0.vaults.vault6',
50+
BigInt(742),
51+
new Date('2024-12-09 23:13:19.186'),
52+
'published.wallet.agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q.current',
53+
),
54+
55+
new VaultStatesDaily(
56+
'20241209',
57+
BigInt(742),
58+
new Date('2024-12-09 23:13:19.186'),
59+
BigInt(4),
60+
BigInt(3),
61+
BigInt(0),
62+
BigInt(0),
63+
BigInt(0),
64+
),
65+
],
66+
67+
'handleStateChangeEvent',
68+
);
69+
70+
subqlTest(
71+
'VaultManagerMetricsDaily, VaultManagerMetrics, VaultManagerGovernance, ReserveMetrics, \
72+
ReserveAllocationMetrics, and ReserveAllocationMetricsDaily at block height 1212',
73+
1212,
74+
[],
75+
[
76+
new VaultManagerGovernance(
77+
'published.vaultFactory.managers.manager1.governance',
78+
BigInt(1212),
79+
new Date('2024-12-16 11:42:27.202'),
80+
BigInt(1000000000),
81+
BigInt(100),
82+
BigInt(1),
83+
BigInt(100),
84+
BigInt(150),
85+
BigInt(100),
86+
BigInt(25),
87+
BigInt(100),
88+
BigInt(1),
89+
BigInt(10000),
90+
BigInt(50),
91+
),
92+
new VaultManagerMetrics(
93+
'published.vaultFactory.managers.manager1.metrics',
94+
BigInt(1212),
95+
new Date('2024-12-16 11:42:27.202'),
96+
'stATOM',
97+
BigInt(0),
98+
'IST',
99+
BigInt(0),
100+
BigInt(0),
101+
BigInt(0),
102+
BigInt(0),
103+
BigInt(0),
104+
BigInt(0),
105+
BigInt(0),
106+
BigInt(0),
107+
BigInt(0),
108+
BigInt(0),
109+
BigInt(0),
110+
BigInt(0),
111+
BigInt(0),
112+
BigInt(0),
113+
),
114+
new VaultManagerMetricsDaily(
115+
' published.vaultFactory.managers.manager1.metrics:20241216',
116+
'published.vaultFactory.managers.manager1.metrics',
117+
20241216,
118+
BigInt(1212),
119+
new Date('2024-12-16 11:42:27.202'),
120+
),
121+
new ReserveMetrics(
122+
'published.reserve.metrics',
123+
BigInt(1212),
124+
new Date('2024-12-16T11:42:27.202Z'),
125+
BigInt(0),
126+
BigInt(0),
127+
BigInt(0),
128+
),
129+
new ReserveAllocationMetrics(
130+
'IST',
131+
BigInt(1212),
132+
new Date('2024-12-16T11:42:27.202Z'),
133+
'IST',
134+
'Fee',
135+
BigInt(184980868),
136+
'published.reserve.metrics',
137+
),
138+
new ReserveAllocationMetricsDaily(
139+
'IST:20241216',
140+
'IST',
141+
20241216,
142+
BigInt(1212),
143+
new Date('2024-12-16T11:42:27.000Z'),
144+
),
145+
],
146+
'handleStateChangeEvent',
147+
);

0 commit comments

Comments
 (0)