diff --git a/src/utils/account.test.js b/src/utils/account.test.js index 25b4eed896..f343800975 100644 --- a/src/utils/account.test.js +++ b/src/utils/account.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { extractPublicKey, extractAddress } from './account'; +import { extractPublicKey, extractAddress, getActiveTokenAccount } from './account'; describe('Utils: Account', () => { describe('extractPublicKey', () => { @@ -27,4 +27,29 @@ describe('Utils: Account', () => { expect(extractAddress()).to.be.equal(false); }); }); + + describe('getActiveTokenAccount', () => { + it('should get account with active token info on the top level', () => { + const activeToken = 'BTC'; + const account = { + info: { + BTC: { + address: 'btc address dummy', + }, + }, + }; + const state = { + account, + settings: { + token: { + active: activeToken, + }, + }, + }; + expect(getActiveTokenAccount(state)).to.be.deep.equal({ + ...account, + ...account.info[activeToken], + }); + }); + }); });