-
Notifications
You must be signed in to change notification settings - Fork 2
Testing Local Storage Calls
So you've got your local storage call to RNFS all set up in LessonPlanService.js, but want to test if it actually works or not. The ideal way to do this would be by using Jest, but for now here's 2 alternative ways to test.
While you have your iPhone simulator instance running, you can peek into the device's internal storage by opening a new terminal tab and ls
-ing into its storage, typically at the following path:
~/Library/Developer/CoreSimulator/Devices/[DEVICE ID]/data/Containers/Data/Application/[APP ID]/Documents
Get the Device ID by going into Xcode: Window -> Devices and Simulators -> Simulators. The Identifier
value is the device ID.
Alternatively, you can also add a breakpoint in Xcode and perform the action po NSHomeDirectory()
upon break.
Check the internal storage in Android Studio via the following method. You'll specifically want to go into data/data/sistema/
to check app data, which you are writing and reading.
- Import Local (or just an individual function) into App.js
- Call your functions inside MainNavigator, make sure the console.logs return something valuable
- Check outputs in the Metro server Terminal window!
Using readDirectory() from Local.js is a fast way of making sure your files are all there in your directory, so you can use that a lot to view your internal storage details! For example; here's how I tested Local.js in App.js!