feat: Add in the read dir. (#2141)

* feat: Add in the read dir.

Have a test that proves that this is working.

* chore: Let the read dir work while in a read only mode

* revert: To old sync
This commit is contained in:
J H
2023-02-17 12:32:18 -07:00
committed by Aiden McClelland
parent 4d3df867da
commit 2736fa5202
4 changed files with 138 additions and 1 deletions

View File

@@ -888,6 +888,49 @@ export const action = {
},
};
},
/**
* Test is for the feature of listing what's in a dir
* @param {*} effects
* @param {*} _input
* @returns
*/
async "test-read-dir"(effects, _input) {
await effects
.removeDir({
volumeId: "main",
path: "test-read-dir",
})
.catch(() => {});
await effects.createDir({
volumeId: "main",
path: "test-read-dir/deep/123",
});
await effects.writeFile({
path: "./test-read-dir/broken.log",
toWrite: "This is a test",
volumeId: "main",
})
let readDir = JSON.stringify(await effects.readDir({
volumeId: "main",
path: "test-read-dir",
}))
const expected = '["broken.log","deep"]'
assert(readDir === expected, `Failed to match the input (${readDir}) === (${expected}) of readDir`)
await effects.removeDir({
volumeId: "main",
path: "test-read-dir",
});
return {
result: {
copyable: false,
message: "Done",
version: "0",
qr: false,
},
};
},
/**
* Created this test because of issue
* https://github.com/Start9Labs/embassy-os/issues/2121