Skip to content

Commit

Permalink
test: add tests for vault and reserve entities
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Dec 16, 2024
1 parent 0970e1f commit d900801
Showing 1 changed file with 112 additions and 3 deletions.
115 changes: 112 additions & 3 deletions src/test/mappingHandlers.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/** @file test against agoric-3-proposals:latest */
import { subqlTest } from '@subql/testing';
import { StateChangeEvent, Wallet } from '../types';
import {
ReserveAllocationMetrics,
ReserveAllocationMetricsDaily,
ReserveMetrics,
StateChangeEvent,
Vault,
VaultManagerGovernance,
VaultManagerMetrics,
VaultManagerMetricsDaily,
VaultStatesDaily,
Wallet,
} from '../types';

// FIXME observed in A3P:latest but not passing tests
subqlTest(
'StateChangeEvent in state_change at block 627',
627, // block height to process
// dependent entities
627,
[],
[
new Wallet(
Expand All @@ -29,3 +39,102 @@ subqlTest(

'handleStateChangeEvent',
);

subqlTest(
'Vault and VaultStateDailies at height 742',
742,
[],
[
new Vault(
'published.vaultFactory.managers.manager0.vaults.vault6',
BigInt(742),
new Date('2024-12-09 23:13:19.186'),
'published.wallet.agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q.current',
),

new VaultStatesDaily(
'20241209',
BigInt(742),
new Date('2024-12-09 23:13:19.186'),
BigInt(1),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
),
],

'handleStateChangeEvent',
);

subqlTest(
'VaultManagerGovernance, VaultManagerMetrics, VaultManagerMetricsDaily, ReserveMetrics, \
and ReserveAllocationMetrics at block height 1212',
1212,
[],
[
new VaultManagerGovernance(
'published.vaultFactory.managers.manager1.governance',
BigInt(1212),
new Date('2024-12-16 11:42:27.202'),
BigInt(1000000000),
BigInt(100),
BigInt(1),
BigInt(100),
BigInt(150),
BigInt(100),
BigInt(25),
BigInt(100),
BigInt(1),
BigInt(10000),
BigInt(50),
),
new VaultManagerMetrics(
'published.vaultFactory.managers.manager1.metrics',
BigInt(1212),
new Date('2024-12-16 11:42:27.202'),
'stATOM',
BigInt(0),
'IST',
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
BigInt(0),
),
new VaultManagerMetricsDaily(
' published.vaultFactory.managers.manager1.metrics:20241216',
'published.vaultFactory.managers.manager1.metrics',
20241216,
BigInt(1212),
new Date('2024-12-16 11:42:27.202'),
),
new ReserveMetrics(
'published.reserve.metrics',
BigInt(1212),
new Date('2024-12-16T11:42:27.202Z'),
BigInt(0),
BigInt(0),
BigInt(0),
),
new ReserveAllocationMetrics(
'IST',
BigInt(1212),
new Date('2024-12-16T11:42:27.202Z'),
'IST',
'Fee',
BigInt(184980868),
'published.reserve.metrics',
),
],
'handleStateChangeEvent',
);

0 comments on commit d900801

Please sign in to comment.