Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Dec 13, 2024
1 parent 475cf4c commit b29ea2a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/mappings/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export const VAULT_STATES = {
LIQUIDATED_CLOSED: 'liquidatedClosed',
};

export const VALUE_KEY = b64encode('value');
export const STORE_KEY = b64encode('store');
export const VSTORAGE_VALUE = b64encode('vstorage');
export const KEY_KEY = b64encode('key');
export const STORE_NAME_KEY = b64encode('store_name');
export const SUBKEY_KEY = b64encode('store_subkey');
export const UNPROVED_VALUE_KEY = b64encode('unproved_value');
export const VALUE_KEY = 'value';
export const STORE_KEY = 'store';
export const VSTORAGE_VALUE = 'vstorage';
export const KEY_KEY = 'key';
export const STORE_NAME_KEY = 'store_name';
export const SUBKEY_KEY = 'store_subkey';
export const UNPROVED_VALUE_KEY = 'unproved_value';
export const PACKET_DATA_KEY = 'packet_data';
export const PACKET_SRC_CHANNEL_KEY = 'packet_src_channel';
export const PACKET_DST_CHANNEL_KEY = 'packet_dst_channel';
Expand Down
1 change: 1 addition & 0 deletions src/mappings/events/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri
}

async function saveWallets(payload: any): Promise<Promise<any>[]> {
logger.info(`PAYLOAD: ${JSON.stringify(payload)}`);
const promises: Promise<void>[] = [];
const address = path.split('.')[2];
const wallet = new Wallet(path, BigInt(data.blockHeight), block.block.header.time as any, address);
Expand Down
3 changes: 3 additions & 0 deletions src/mappings/mappingHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export async function handleBundleInstallMessage(message: CosmosMessage): Promis
export async function handleStateChangeEvent(cosmosEvent: CosmosEvent): Promise<void> {
const { event, block } = cosmosEvent as CosmosEvent & { event: tendermint37.Event };

logger.info(`EVENT ${JSON.stringify(event)}`);
logger.info(`EVENT TYPE:${event.type}`);

if (event.type != EVENT_TYPES.STATE_CHANGE) {
logger.warn('Not valid state_change event.');
return;
Expand Down
24 changes: 13 additions & 11 deletions src/test/mappingHandlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ import { StateChangeEvent, Wallet } from '../types';

// FIXME observed in A3P:latest but not passing tests
subqlTest(
'Wallet and StateChangeEvent in state_change at block 627',
'StateChangeEvent in state_change at block 627',
627, // block height to process
[], // dependent entities
// dependent entities
[],
[
new Wallet(
'published.wallet.agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk.current',
BigInt(627),
new Date('"2024-12-09T23:09:55.9Z"'),
'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
new Date('2024-12-09T23:07:18.273Z'),
'agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk',
),
new StateChangeEvent(
'627:37:1',
'627:39:3',
BigInt(627),
new Date('2024-12-09T23:09:55.9Z'),
new Date('2024-12-09T23:07:18.273Z'),
'published.wallet',
'published.wallet.agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
0,
'["board0257"]',
'{"status":{"id":"closeVault-1733785795438","invitationSpec":{"invitationMakerName":"CloseVault","previousOffer":"openVault-1733785785382","source":"continuing"},"numWantsSatisfied":1,"proposal":{"give":{"Minted":{"brand":"$0.Alleged: IST brand","value":"+5750000","__brand":"IST","__value":"5750000"}},"want":{}},"result":"your vault is closed, thank you for your business"},"updated":"offerStatus"}',
'published.wallet.agoric1rwwley550k9mmk6uq6mm6z4udrg8kyuyvfszjk.current',
3,
'["board05557","board0257","board0074",null,"board05815","board00360"]',
'{"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"}]}',
),
],

'handleStateChangeEvent',
);

0 comments on commit b29ea2a

Please sign in to comment.