Commit 660fd326 authored by Tankred Hase's avatar Tankred Hase

Implement channelPercentageLabel

parent 66aa45a9
......@@ -35,6 +35,15 @@ const ComputedWallet = store => {
const { settings } = store;
return !settings.displayFiat ? UNITS[settings.unit].display : null;
},
get channelPercentageLabel() {
const {
channelBalanceSatoshis: opened,
pendingBalanceSatoshis: pending,
totalBalanceSatoshis: total,
} = store;
const percent = total ? (opened + pending) / total * 100 : 0;
return `${Math.round(percent)}% in Channels`;
},
get newPasswordCopy() {
const { newPassword } = store.wallet;
return getNewPasswordCopy({ newPassword });
......
......@@ -18,6 +18,7 @@ describe('Computed Wallet Unit Tests', () => {
expect(store.unitLabel, 'to equal', null);
expect(store.newPasswordCopy, 'to equal', '');
expect(store.newPasswordSuccess, 'to equal', null);
expect(store.channelPercentageLabel, 'to equal', '0% in Channels');
});
it('should generate valid wallet address uri', () => {
......@@ -41,6 +42,7 @@ describe('Computed Wallet Unit Tests', () => {
expect(store.totalBalanceLabel, 'to match', /6[,.]895[,.]81/);
expect(store.unitFiatLabel, 'to equal', '$');
expect(store.unitLabel, 'to equal', null);
expect(store.channelPercentageLabel, 'to equal', '50% in Channels');
});
it('should display channel balance in sat', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment