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
a73c7077
Commit
a73c7077
authored
Aug 27, 2019
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if SCB file exists on external storage before reading
parent
000d169d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
file-mobile.js
src/action/file-mobile.js
+2
-0
file-mobile.spec.js
test/unit/action/file-mobile.spec.js
+7
-1
No files found.
src/action/file-mobile.js
View file @
a73c7077
...
...
@@ -103,6 +103,8 @@ class FileAction {
}
async
readSCBFromExternalStorage
()
{
const
exists
=
await
this
.
_FS
.
exists
(
this
.
scbExternalPath
);
if
(
!
exists
)
return
;
return
this
.
_FS
.
readFile
(
this
.
scbExternalPath
,
'base64'
);
}
}
...
...
test/unit/action/file-mobile.spec.js
View file @
a73c7077
...
...
@@ -132,8 +132,14 @@ describe('Action File Mobile Unit Tests', () => {
});
describe
(
'get readSCBFromExternalStorage()'
,
()
=>
{
it
(
'should get lnd directory'
,
async
()
=>
{
it
(
'should read the scb if it exists'
,
async
()
=>
{
RNFS
.
exists
.
resolves
(
true
);
expect
(
await
file
.
readSCBFromExternalStorage
(),
'to equal'
,
'some-data'
);
});
it
(
'should not read the scb if it does not exist'
,
async
()
=>
{
RNFS
.
exists
.
resolves
(
false
);
expect
(
await
file
.
readSCBFromExternalStorage
(),
'to equal'
,
undefined
);
});
});
});
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