Hi all, I am trying to write some unit tests for my little project called JetSet, in which we used expo-file-system to handle internal storage.
In my test, I wrote something like:
describe('\nsaveNewFile() is tested.\n', ()=>{
it("An empty file is going to be created.",async ()=>{
const path = FileSystem.documentDirectory + "testing.txt";
promiseHolder = await FileSystem.readAsStringAsync(path).then(
function(result){
console.log("File has existed.");
console.log(result);
},
function(err){
SaveData.saveNewFile("Hello from test","testing.txt");
}
);
console.log(FileSystem.documentDirectory);
console.log(promiseHolder);
When I run this test, result, Filesystem.documentDirectory and promiseHolder are all undefined. I feel like I did wrong in some steps but I do not realize where it is. Any helps would be great, thank you.