Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Refactored transaction fee estimates unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vardan10 committed Nov 21, 2023
1 parent b287e7a commit 95fd879
Showing 1 changed file with 22 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ const {
mockRegisterValidatorTxResult,
} = require('../../constants/transactionEstimateFees');

const { tokenHasUserAccount } = require('../../../../../shared/dataService/business/token');

const {
tokenHasUserAccount,
getTokenConstants,
getTokenBalances,
} = require('../../../../../shared/dataService/business/token');
dryRunTransactions,
} = require('../../../../../shared/dataService/business/transactionsDryRun');

const { requestConnector } = require('../../../../../shared/utils/request');

jest.mock('lisk-service-framework', () => {
const actual = jest.requireActual('lisk-service-framework');
Expand Down Expand Up @@ -138,41 +140,29 @@ jest.mock('../../../../../shared/dataService/business/schemas', () => {
});

jest.mock('../../../../../shared/dataService/business/token', () => ({
tokenHasUserAccount: jest.fn(),
getTokenConstants: jest.fn(),
getTokenBalances: jest.fn(),
}));

tokenHasUserAccount.mockImplementation(() => ({
data: { isExists: true },
meta: {},
}));

getTokenConstants.mockImplementation(() => ({
data: {
extraCommandFees: {
userAccountInitializationFee: '5000000',
escrowAccountInitializationFee: '5000000',
tokenHasUserAccount: jest.fn().mockImplementation(() => ({
data: { isExists: true },
meta: {},
})),
getTokenConstants: jest.fn().mockImplementation(() => ({
data: {
extraCommandFees: {
userAccountInitializationFee: '5000000',
escrowAccountInitializationFee: '5000000',
},
},
},
meta: {},
}));

getTokenBalances.mockImplementation(() => ({
data: [{ availableBalance: '500000000000' }],
meta: {},
meta: {},
})),
getTokenBalances: jest.fn().mockImplementation(() => ({
data: [{ availableBalance: '500000000000' }],
meta: {},
})),
}));

const {
dryRunTransactions,
} = require('../../../../../shared/dataService/business/transactionsDryRun');

jest.mock('../../../../../shared/dataService/business/transactionsDryRun', () => ({
dryRunTransactions: jest.fn(),
}));

const { requestConnector } = require('../../../../../shared/utils/request');

jest.mock('../../../../../shared/utils/request', () => ({
requestConnector: jest.fn(),
}));
Expand Down

0 comments on commit 95fd879

Please sign in to comment.