()
| 40 | } |
| 41 | |
| 42 | function testWriteAndReadFile() { |
| 43 | var path = RNFS.DocumentDirectoryPath + '/test.txt'; |
| 44 | |
| 45 | var text = 'Lorem ipsum dolor sit amet'; |
| 46 | var readText; |
| 47 | |
| 48 | RNFS.writeFile(path, text) |
| 49 | .then((success) => { |
| 50 | updateMessage('FILE WRITTEN!'); |
| 51 | return RNFS.readFile(path); |
| 52 | }) |
| 53 | .then((contents) => { |
| 54 | updateMessage('FILE READ! Contents:'); |
| 55 | readText = contents; |
| 56 | expectEqual(text, readText, 'testWriteAndReadFile'); |
| 57 | updateMessage('readFile correctly returned' + readText); |
| 58 | }) |
| 59 | .finally(() => { |
| 60 | runTestCase('testCreateAndDeleteFile', testCreateAndDeleteFile); |
| 61 | }) |
| 62 | .done();//promise done needed to throw exception so that in case test fails,error is propagated |
| 63 | } |
| 64 | |
| 65 | |
| 66 |
no test coverage detected