expo-file-system documentDirectory is undefined?

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.

How can I test if the file has been saved?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.