@@ -10,6 +10,14 @@ describe('Action Logs Unit Tests', () => {
1010 let ipc ;
1111 let ipcRenderer ;
1212
13+ const RNFS = {
14+ DocumentDirectoryPath : '/foo/bar' ,
15+ readFile : ( ) => Promise . resolve ( 'logs' ) ,
16+ } ;
17+ const Share = {
18+ share : ( ) => Promise . resolve ( true ) ,
19+ } ;
20+
1321 beforeEach ( ( ) => {
1422 sandbox = sinon . createSandbox ( { } ) ;
1523 ipcRenderer = {
@@ -115,5 +123,38 @@ describe('Action Logs Unit Tests', () => {
115123 expect ( store . logs . length , 'to equal' , 56 ) ;
116124 } ) ;
117125 } ) ;
126+
127+ describe ( 'getLogPath()' , ( ) => {
128+ it ( 'should throw without a FS constructor argument' , ( ) => {
129+ expect ( ( ) => log . getLogPath ( ) , 'to throw' ) ;
130+ } ) ;
131+
132+ it ( 'should return a log path with FS constructor argument' , ( ) => {
133+ new LogAction ( store , ipc , false , RNFS ) ;
134+ expect ( log . getLogPath ( ) , 'to be a string' ) ;
135+ } ) ;
136+ } ) ;
137+
138+ describe ( 'getLogs()' , ( ) => {
139+ it ( 'should throw without a FS constructor argument' , async ( ) => {
140+ await expect ( log . getLogs ( ) , 'to be rejected' ) ;
141+ } ) ;
142+
143+ it ( 'should return logs with an FS constructor argument' , async ( ) => {
144+ new LogAction ( store , ipc , false , RNFS ) ;
145+ expect ( await log . getLogs ( ) , 'to be a string' ) ;
146+ } ) ;
147+ } ) ;
148+
149+ describe ( 'shareLogs()' , ( ) => {
150+ it ( 'should throw without a Share or FS constructor argument' , async ( ) => {
151+ await expect ( log . shareLogs ( ) , 'to be rejected' ) ;
152+ } ) ;
153+
154+ it ( 'should share the logs with a Share and FS constructor argument' , async ( ) => {
155+ new LogAction ( store , ipc , false , RNFS , Share ) ;
156+ expect ( await log . shareLogs ( ) , 'to be ok' ) ;
157+ } ) ;
158+ } ) ;
118159 } ) ;
119160} ) ;
0 commit comments