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
04b678ea
Commit
04b678ea
authored
Feb 13, 2019
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement channelStatus from computed sat channel balances
parent
f2b8d059
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
channel.js
src/computed/channel.js
+14
-0
channel.spec.js
test/unit/computed/channel.spec.js
+14
-0
No files found.
src/computed/channel.js
View file @
04b678ea
...
...
@@ -78,6 +78,20 @@ const ComputedChannel = store => {
get
showChannelAlert
()
{
return
(
store
.
channels
||
[]).
length
===
0
;
},
get
channelStatus
()
{
const
{
channelBalanceOpenSatoshis
:
opened
,
channelBalanceInactiveSatoshis
:
inactive
,
channelBalancePendingSatoshis
:
pending
,
}
=
store
;
return
opened
?
'success'
:
inactive
?
'inactive'
:
pending
?
'info'
:
'error'
;
},
});
};
...
...
test/unit/computed/channel.spec.js
View file @
04b678ea
...
...
@@ -58,6 +58,7 @@ describe('Computed Channels Unit Tests', () => {
expect
(
store
.
channelBalancePendingLabel
,
'to equal'
,
'0'
);
expect
(
store
.
channelBalanceClosingLabel
,
'to equal'
,
'0'
);
expect
(
store
.
showChannelAlert
,
'to equal'
,
true
);
expect
(
store
.
channelStatus
,
'to equal'
,
'error'
);
});
it
(
'should aggregate open and pending channels'
,
()
=>
{
...
...
@@ -88,6 +89,7 @@ describe('Computed Channels Unit Tests', () => {
expect
(
store
.
channelBalancePendingLabel
,
'to match'
,
/0
[
,.
]
006/
);
expect
(
store
.
channelBalanceClosingLabel
,
'to match'
,
/0
[
,.
]
005/
);
expect
(
store
.
showChannelAlert
,
'to equal'
,
false
);
expect
(
store
.
channelStatus
,
'to equal'
,
'success'
);
});
it
(
'should channel values in usd'
,
()
=>
{
...
...
@@ -104,5 +106,17 @@ describe('Computed Channels Unit Tests', () => {
expect
(
store
.
channelBalancePendingLabel
,
'to match'
,
/41
[
,.
]
37/
);
expect
(
store
.
channelBalanceClosingLabel
,
'to match'
,
/34
[
,.
]
48/
);
});
it
(
'should display pending status'
,
()
=>
{
store
.
channels
=
null
;
ComputedChannel
(
store
);
expect
(
store
.
channelStatus
,
'to equal'
,
'info'
);
});
it
(
'should display inactive status'
,
()
=>
{
store
.
channels
[
0
].
active
=
false
;
ComputedChannel
(
store
);
expect
(
store
.
channelStatus
,
'to equal'
,
'inactive'
);
});
});
});
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