Skip to content

Commit 34111d6

Browse files
committed
test: update tests
1 parent cf74710 commit 34111d6

File tree

4 files changed

+86
-82
lines changed

4 files changed

+86
-82
lines changed

.github/workflows/vaults-and-reserve-metrics-testing.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,41 +51,41 @@ jobs:
5151
- name: Wait for GraphQL server
5252
run: sleep 60
5353

54-
# - name: Test VaultManagerGovernance
55-
# run: ./scripts/validateData.mjs
56-
# env:
57-
# entity: vaultManagerGovernances
58-
# blockHeight: 1178
59-
60-
# - name: Test VaultManagerMetrics
61-
# run: ./scripts/validateData.mjs
62-
# env:
63-
# entity: vaultManagerMetrics
64-
# blockHeight: 1170
54+
- name: Test VaultManagerGovernance
55+
run: ./scripts/validateData.mjs
56+
env:
57+
entity: vaultManagerGovernances
58+
blockHeight: 1185
59+
60+
- name: Test VaultManagerMetrics
61+
run: ./scripts/validateData.mjs
62+
env:
63+
entity: vaultManagerMetrics
64+
blockHeight: 1226
6565

6666
- name: Test VaultManagerMetricsDaily
6767
run: ./scripts/validateData.mjs
6868
env:
6969
entity: vaultManagerMetricsDailies
70-
blockHeight: 1231
70+
blockHeight: 1226
7171

7272
- name: Test ReserveMetrics
7373
run: ./scripts/validateData.mjs
7474
env:
7575
entity: reserveMetrics
76-
blockHeight: 1231
76+
blockHeight: 1226
7777

7878
- name: Test ReserveAllocationMetrics
7979
run: ./scripts/validateData.mjs
8080
env:
8181
entity: reserveAllocationMetrics
82-
blockHeight: 1231
82+
blockHeight: 1226
8383

8484
- name: Test ReserveAllocationMetricsDaily
8585
run: ./scripts/validateData.mjs
8686
env:
8787
entity: reserveAllocationMetricsDailies
88-
blockHeight: 1231
88+
blockHeight: 1226
8989

9090
- name: Notify About Failure
9191
if: >

scripts/queries.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,40 +127,40 @@ export const expectations = {
127127
mintFeeNumerator: '50',
128128
},
129129
vaultManagerMetrics: {
130-
liquidatingCollateralBrand: 'stATOM',
130+
liquidatingCollateralBrand: 'ATOM',
131131
liquidatingCollateralValue: '0',
132132
liquidatingDebtBrand: 'IST',
133133
liquidatingDebtValue: '0',
134134
lockedQuoteDenominator: '0',
135135
lockedQuoteNumerator: '0',
136-
numActiveVaults: '0',
136+
numActiveVaults: '7',
137137
numLiquidatingVaults: '0',
138138
numLiquidationsAborted: '0',
139139
numLiquidationsCompleted: '0',
140140
retainedCollateral: '0',
141-
totalCollateral: '0',
141+
totalCollateral: '5982000000',
142142
totalCollateralSold: '0',
143-
totalDebt: '0',
143+
totalDebt: '35984025000',
144144
totalOverageReceived: '0',
145145
totalProceedsReceived: '0',
146146
totalShortfallReceived: '0',
147147
},
148148
vaultManagerMetricsDailies: {
149-
path: 'published.vaultFactory.managers.manager1.metrics',
150-
liquidatingCollateralBrand: 'stATOM',
149+
path: 'published.vaultFactory.managers.manager0.metrics',
150+
liquidatingCollateralBrand: 'ATOM',
151151
liquidatingDebtBrand: 'IST',
152152
liquidatingCollateralValueLast: '0',
153153
liquidatingDebtValueLast: '0',
154154
lockedQuoteDenominatorLast: '0',
155155
lockedQuoteNumeratorLast: '0',
156-
numActiveVaultsLast: '0',
156+
numActiveVaultsLast: '7',
157157
numLiquidatingVaultsLast: '0',
158158
numLiquidationsAbortedLast: '0',
159159
numLiquidationsCompletedLast: '0',
160160
retainedCollateralLast: '0',
161-
totalCollateralLast: '0',
161+
totalCollateralLast: '5982000000',
162162
totalCollateralSoldLast: '0',
163-
totalDebtLast: '0',
163+
totalDebtLast: '35984025000',
164164
totalOverageReceivedLast: '0',
165165
totalProceedsReceivedLast: '0',
166166
totalShortfallReceivedLast: '0',

src/test/installBundleHandler.test.ts

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

src/test/mappingHandlers.test.ts

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,43 @@ import {
77
PsmGovernance,
88
PsmMetrics,
99
PsmMetricsDaily,
10-
ReserveAllocationMetrics,
11-
ReserveAllocationMetricsDaily,
12-
ReserveMetrics,
1310
StateChangeEvent,
1411
Vault,
15-
VaultManagerGovernance,
16-
VaultManagerMetrics,
17-
VaultManagerMetricsDaily,
1812
VaultStatesDaily,
1913
Wallet,
2014
} from '../types';
2115

2216
// FIXME observed in A3P:latest but not passing tests
2317
subqlTest(
24-
'StateChangeEvent in state_change at block 627',
25-
627,
18+
'StateChangeEvent in state_change at block 85',
19+
85,
2620
[],
2721
[
28-
new Wallet(
29-
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk.current',
30-
BigInt(627),
31-
new Date('2024-12-09T23:07:18.273Z'),
32-
'agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
33-
),
3422
new StateChangeEvent(
35-
'627:39:3',
36-
BigInt(627),
37-
new Date('2024-12-09T23:07:18.273Z'),
23+
'85:97:4',
24+
BigInt(85),
25+
new Date('2024-12-26T12:53:10.730'),
3826
'published.wallet',
39-
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk.current',
40-
3,
41-
'["board05557","board0257","board0074",null,"board05815","board00360"]',
42-
'{"liveOffers":[["openVault-1733785637736",{"id":"openVault-1733785637736","invitationSpec":{"callPipe":[["getCollateralManager",["$0.Alleged: ATOM brand"]],["makeVaultInvitation"]],"instancePath":["VaultFactory"],"source":"agoricContract"},"proposal":{"give":{"Collateral":{"brand":"$0","value":"+583000000","__brand":"ATOM","__value":"583000000"}},"want":{"Minted":{"brand":"$1.Alleged: IST brand","value":"+3489000000","__brand":"IST","__value":"3489000000"}}}}]],"offerToPublicSubscriberPaths":[["openVault-1733785637736",{"vault":"published.vaultFactory.managers.manager0.vaults.vault4"}]],"offerToUsedInvitation":[["openVault-1733785637736",{"brand":"$2.Alleged: Zoe Invitation brand","value":[{"description":"manager0: MakeVault","handle":"$3.Alleged: InvitationHandle","installation":"$4.Alleged: BundleIDInstallation","instance":"$5.Alleged: InstanceHandle","__handle":"InvitationHandle","__installation":"BundleIDInstallation","__instance":"InstanceHandle"}],"__brand":"Zoe Invitation"}]],"purses":[{"balance":{"brand":"$2","value":[],"__brand":"Zoe Invitation"},"brand":"$2","__brand":"Zoe Invitation"}]}',
27+
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
28+
4,
29+
'["board0223"]',
30+
'{"currentAmount":{"brand":{"@qclass":"slot","iface":"Alleged: USDC_axl brand","index":0},"value":{"@qclass":"bigint","digits":"0"},"__brand":"USDC_axl","__value":"0"},"updated":"balance"}',
31+
),
32+
],
33+
34+
'handleStateChangeEvent',
35+
);
36+
37+
subqlTest(
38+
'Wallet existence on height 1133',
39+
1133,
40+
[],
41+
[
42+
new Wallet(
43+
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
44+
BigInt(1133),
45+
new Date('2024-12-26T13:26:39.5'),
46+
'agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
4347
),
4448
],
4549

@@ -48,8 +52,8 @@ subqlTest(
4852

4953
const vault = new Vault(
5054
'published.vaultFactory.managers.manager0.vaults.vault6',
51-
BigInt(742),
52-
new Date('2024-12-09 23:13:19.186'),
55+
BigInt(1149),
56+
new Date('2024-12-26T13:28:09.172'),
5357
'published.wallet.agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q.current',
5458
);
5559

@@ -61,15 +65,15 @@ vault.debt = BigInt(4745610000);
6165
vault.state = 'active';
6266

6367
subqlTest(
64-
'Vault and VaultStateDailies at height 742',
65-
742,
68+
'Vault and VaultStateDailies at height 1149',
69+
1149,
6670
[],
6771
[
6872
vault,
6973
new VaultStatesDaily(
70-
'20241209',
71-
BigInt(742),
72-
new Date('2024-12-09 23:13:19.186'),
74+
'20241226',
75+
BigInt(1149),
76+
new Date('2024-12-26T13:28:09.172'),
7377
BigInt(1),
7478
BigInt(0),
7579
BigInt(0),
@@ -82,31 +86,31 @@ subqlTest(
8286
);
8387

8488
subqlTest(
85-
'BoardAux at block 643',
86-
643,
89+
'BoardAux at block 652',
90+
652,
8791
[],
8892
[
8993
new BoardAux(
9094
'published.boardAux.board0074',
91-
BigInt(643),
92-
new Date('2024-12-09T23:07:37.423Z'),
95+
BigInt(652),
96+
new Date('2024-12-26T13:10:08.048'),
9397
'Zoe Invitation',
9498
'set',
9599
0,
96100
),
97101
new BoardAux(
98102
'published.boardAux.board01744',
99-
BigInt(643),
100-
new Date('2024-12-09T23:07:37.423Z'),
103+
BigInt(652),
104+
new Date('2024-12-26T13:10:08.048'),
101105
'USDT_axl',
102106
'nat',
103107
6,
104108
),
105-
new BoardAux('published.boardAux.board0257', BigInt(643), new Date('2024-12-09T23:07:37.423Z'), 'IST', 'nat', 6),
109+
new BoardAux('published.boardAux.board0257', BigInt(652), new Date('2024-12-26T13:10:08.048'), 'IST', 'nat', 6),
106110
new BoardAux(
107111
'published.boardAux.board03040',
108-
BigInt(643),
109-
new Date('2024-12-09T23:07:37.423Z'),
112+
BigInt(652),
113+
new Date('2024-12-26T13:10:08.048'),
110114
'USDC_axl',
111115
'nat',
112116
6,
@@ -117,10 +121,10 @@ subqlTest(
117121
);
118122

119123
const oraclePriceDaily = new OraclePriceDaily(
120-
'ATOM-USD:20241209',
121-
20241209,
122-
BigInt(506),
123-
new Date('2024-12-09T23:03:17.000Z'),
124+
'ATOM-USD:20241226',
125+
20241226,
126+
BigInt(509),
127+
new Date('2024-12-26T13:05:39.000'),
124128
);
125129

126130
oraclePriceDaily.typeInAmountLast = BigInt(1000000);
@@ -133,8 +137,8 @@ oraclePriceDaily.metricsCount = BigInt(1);
133137

134138
const oraclePrice = new OraclePrice(
135139
'ATOM-USD',
136-
BigInt(506),
137-
new Date('2024-12-09T23:03:17.564Z'),
140+
BigInt(509),
141+
new Date('2024-12-26T13:05:39.056'),
138142
'ATOM-USD',
139143
BigInt(1000000),
140144
BigInt(12010000),
@@ -143,20 +147,20 @@ const oraclePrice = new OraclePrice(
143147
);
144148

145149
subqlTest(
146-
'oraclePrice at block 506',
147-
506,
150+
'oraclePrice at block 509',
151+
509,
148152
[],
149153
[oraclePriceDaily, oraclePrice],
150154

151155
'handleStateChangeEvent',
152156
);
153157

154158
const psmMetricsDaily = new PsmMetricsDaily(
155-
'published.psm.IST.USDC_axl.metrics:20241207',
159+
'published.psm.IST.USDC_axl.metrics:20241226',
156160
'published.psm.IST.USDC_axl.metrics',
157-
20241207,
161+
20241226,
158162
BigInt(35),
159-
new Date('2024-12-07T02:03:32.000Z'),
163+
new Date('2024-12-26T12:49:56.000'),
160164
);
161165

162166
psmMetricsDaily.denom = 'USDC_axl';
@@ -170,7 +174,7 @@ psmMetricsDaily.metricsCount = BigInt(1);
170174
const psmMetrics = new PsmMetrics(
171175
'published.psm.IST.USDC_axl.metrics',
172176
BigInt(35),
173-
new Date('2024-12-07T02:03:32.920Z'),
177+
new Date('2024-12-26T12:49:56.863'),
174178
'USDC_axl',
175179
'USDC_axl',
176180
BigInt(0),
@@ -185,7 +189,7 @@ subqlTest('psmMetrics at block 35', 35, [], [psmMetricsDaily, psmMetrics], 'hand
185189
const psmGovernance = new PsmGovernance(
186190
'published.psm.IST.USDT_axl.governance',
187191
BigInt(35),
188-
new Date('2024-12-07T02:03:32.920Z'),
192+
new Date('2024-12-26T12:49:56.863'),
189193
'USDT_axl',
190194
'USDT_axl',
191195
BigInt(1000000000),

0 commit comments

Comments
 (0)