Skip to content

Commit

Permalink
✅ Add unit test for getActiveTokenAccount util
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed May 16, 2019
1 parent 492b5d8 commit 2f40746
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion 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', () => {
Expand Down Expand Up @@ -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],
});
});
});
});

0 comments on commit 2f40746

Please sign in to comment.