Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
lightning-bits
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
lightning-bits
Commits
660fd326
Commit
660fd326
authored
Feb 13, 2019
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement channelPercentageLabel
parent
66aa45a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
wallet.js
src/computed/wallet.js
+9
-0
wallet.spec.js
test/unit/computed/wallet.spec.js
+2
-0
No files found.
src/computed/wallet.js
View file @
660fd326
...
...
@@ -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
});
...
...
test/unit/computed/wallet.spec.js
View file @
660fd326
...
...
@@ -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'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment