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
d17562f5
Commit
d17562f5
authored
Feb 13, 2019
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calculate totalBalanceLabel in computed wallet
parent
684f38d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
wallet.js
src/computed/wallet.js
+11
-2
wallet.spec.js
test/unit/computed/wallet.spec.js
+3
-3
No files found.
src/computed/wallet.js
View file @
d17562f5
...
...
@@ -20,8 +20,17 @@ const ComputedWallet = store => {
const
{
balanceSatoshis
,
pendingBalanceSatoshis
,
settings
}
=
store
;
return
toAmountLabel
(
balanceSatoshis
+
pendingBalanceSatoshis
,
settings
);
},
get
channelBalanceLabel
()
{
return
toAmountLabel
(
store
.
channelBalanceSatoshis
,
store
.
settings
);
get
totalBalanceLabel
()
{
const
{
balanceSatoshis
,
pendingBalanceSatoshis
,
channelBalanceSatoshis
,
settings
,
}
=
store
;
return
toAmountLabel
(
balanceSatoshis
+
pendingBalanceSatoshis
+
channelBalanceSatoshis
,
settings
);
},
get
unitFiatLabel
()
{
const
{
displayFiat
,
unit
,
fiat
}
=
store
.
settings
;
...
...
test/unit/computed/wallet.spec.js
View file @
d17562f5
...
...
@@ -13,7 +13,7 @@ describe('Computed Wallet Unit Tests', () => {
ComputedWallet
(
store
);
expect
(
store
.
walletAddressUri
,
'to equal'
,
''
);
expect
(
store
.
depositLabel
,
'to match'
,
/0
[
,.
]
00/
);
expect
(
store
.
channe
lBalanceLabel
,
'to match'
,
/0
[
,.
]
00/
);
expect
(
store
.
tota
lBalanceLabel
,
'to match'
,
/0
[
,.
]
00/
);
expect
(
store
.
unitFiatLabel
,
'to equal'
,
'$'
);
expect
(
store
.
unitLabel
,
'to equal'
,
null
);
expect
(
store
.
newPasswordCopy
,
'to equal'
,
''
);
...
...
@@ -38,7 +38,7 @@ describe('Computed Wallet Unit Tests', () => {
store
.
channelBalanceSatoshis
=
10000
;
ComputedWallet
(
store
);
expect
(
store
.
depositLabel
,
'to match'
,
/6
[
,.
]
895
[
,.
]
13/
);
expect
(
store
.
channelBalanceLabel
,
'to match'
,
/0
[
,.
]
69
/
);
expect
(
store
.
totalBalanceLabel
,
'to match'
,
/6
[
,.
]
895
[
,.
]
81
/
);
expect
(
store
.
unitFiatLabel
,
'to equal'
,
'$'
);
expect
(
store
.
unitLabel
,
'to equal'
,
null
);
});
...
...
@@ -56,7 +56,7 @@ describe('Computed Wallet Unit Tests', () => {
'to match'
,
/^1
{1}[
,.
]
0
{3}[
,.
]
0
{3}[
,.
]
0
{1}
1
{1}
$/
);
expect
(
store
.
channelBalanceLabel
,
'to equal'
,
'100'
);
expect
(
store
.
totalBalanceLabel
,
'to match'
,
/1
[
,.
]
000
[
,.
]
100
[
,.
]
01/
);
expect
(
store
.
unitFiatLabel
,
'to equal'
,
'bits'
);
expect
(
store
.
unitLabel
,
'to equal'
,
'bits'
);
});
...
...
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