Commit a73c7077 authored by Tankred Hase's avatar Tankred Hase

Check if SCB file exists on external storage before reading

parent 000d169d
......@@ -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');
}
}
......
......@@ -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);
});
});
});
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