diff --git a/src/index.test.ts b/src/index.test.ts index 9b84da2..33c782d 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,8 +1,10 @@ import { Account } from './account'; +import { DENOM } from './constants'; import { Registry } from './index'; -import { getConfig } from './testing/helper'; +import { getConfig, getLaconic2Config } from './testing/helper'; -const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig(); +const { chainId, restEndpoint, gqlEndpoint, privateKey } = getConfig(); +const { fee } = getLaconic2Config(); jest.setTimeout(90 * 1000); @@ -15,30 +17,32 @@ const registryTests = () => { test('Get account info.', async () => { const account = new Account(Buffer.from(privateKey, 'hex')); - const accounts = await registry.getAccounts([account.formattedCosmosAddress]); + await account.init(); + const accounts = await registry.getAccounts([account.address]); expect(accounts).toHaveLength(1); const [accountObj] = accounts; - expect(accountObj.address).toBe(account.formattedCosmosAddress); + expect(accountObj.address).toBe(account.address); expect(accountObj.pubKey).toBe(account.encodedPubkey); expect(accountObj.number).toBe('0'); expect(accountObj.sequence).toBeDefined(); expect(accountObj.balance).toHaveLength(1); const [{ type, quantity }] = accountObj.balance; - expect(type).toBe('aphoton'); + expect(type).toBe(DENOM); expect(quantity).toBeDefined(); }); test('Get account balance.', async () => { const mnenonic1 = Account.generateMnemonic(); const otherAccount = await Account.generateFromMnemonic(mnenonic1); - await registry.sendCoins({ denom: 'aphoton', amount: '100000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee); + await otherAccount.init(); + await registry.sendCoins({ denom: DENOM, amount: '10000', destinationAddress: otherAccount.address }, privateKey, fee); - const [accountObj] = await registry.getAccounts([otherAccount.formattedCosmosAddress]); + const [accountObj] = await registry.getAccounts([otherAccount.address]); expect(accountObj).toBeDefined(); - expect(accountObj.address).toBe(otherAccount.formattedCosmosAddress); + expect(accountObj.address).toBe(otherAccount.address); const [{ type, quantity }] = accountObj.balance; - expect(type).toBe('aphoton'); - expect(quantity).toBe('100000000'); + expect(type).toBe(DENOM); + expect(quantity).toBe('10000'); }); };