diff --git a/services/export/shared/helpers/account.js b/services/export/shared/helpers/account.js index 16ca33eba..4f8cd9229 100644 --- a/services/export/shared/helpers/account.js +++ b/services/export/shared/helpers/account.js @@ -70,7 +70,7 @@ const getTokenBalancesAtGenesis = async () => { // Asynchronously fetch the token module genesis assets and cache locally logger.info('Attempting to fetch and cache the token module genesis assets.'); - await requestConnector('getGenesisAssetsLength', { + requestConnector('getGenesisAssetsLength', { module: MODULE.TOKEN, subStore: MODULE_SUB_STORE.TOKEN.USER, }) diff --git a/services/export/tests/unit/shared/helpers/account.test.js b/services/export/tests/unit/shared/helpers/account.test.js index 113b2409d..4f4f8b7ee 100644 --- a/services/export/tests/unit/shared/helpers/account.test.js +++ b/services/export/tests/unit/shared/helpers/account.test.js @@ -15,6 +15,7 @@ */ const { resolve } = require('path'); +const delay = require('lisk-service-framework/src/delay'); const { valid, invalid } = require('../../../constants/account'); const { transactions } = require('../../../constants/transaction'); @@ -251,8 +252,15 @@ describe('Account utils', () => { const { getTokenBalancesAtGenesis } = require('../../../../shared/helpers/account'); - const tokenBalances = await getTokenBalancesAtGenesis(); - const expectedResponse = [ + const tokenBalances1 = await getTokenBalancesAtGenesis(); + const expectedResponse1 = undefined; + expect(tokenBalances1).toEqual(expectedResponse1); + + // Add delay to let the mock first resolve the async promise from requestConnector + await delay(10); + + const tokenBalances2 = await getTokenBalancesAtGenesis(); + const expectedResponse2 = [ { tokenID: '0400000000000000', address: 'lskyvvam5rxyvbvofxbdfcupxetzmqxu22phm4yuo', @@ -261,7 +269,7 @@ describe('Account utils', () => { }, ]; - expect(tokenBalances).toEqual(expectedResponse); + expect(tokenBalances2).toEqual(expectedResponse2); }); }); }); diff --git a/services/export/tests/unit/shared/helpers/transaction.test.js b/services/export/tests/unit/shared/helpers/transaction.test.js index 42d71932d..3acbc59f6 100644 --- a/services/export/tests/unit/shared/helpers/transaction.test.js +++ b/services/export/tests/unit/shared/helpers/transaction.test.js @@ -23,24 +23,13 @@ const { transactions } = require('../../../constants/transaction'); describe('Test Transaction utility', () => { describe('Validate transaction amount is properly normalized', () => { - xit('should return amount in a standardized format for a valid transaction', async () => { + it('should return null amount for a non token:transfer and token:transferCrossChain transactions', async () => { const amount = normalizeTransactionAmount( transactions.reclaim.sender.address, transactions.reclaim, ); - expect(amount).not.toBeNull(); - expect(typeof amount).toBe('string'); - expect(amount).toBe(transactions.reclaim.params.amount); - }); - - xit('should return positive amount value for reclaim transaction', async () => { - const amount = normalizeTransactionAmount( - transactions.reclaim.sender.address, - transactions.reclaim, - ); - - expect(Number(amount)).toBeGreaterThan(0); + expect(amount).toBeNull(); }); it('should return positive amount value for incoming token transfer transaction', async () => {