feat: Make the rename effect (#1669)

* feat: Make the rename effect

* chore: Change to dst and src

* chore: update the remove file to use dst src
This commit is contained in:
J M
2022-07-20 13:42:54 -06:00
committed by GitHub
parent 0f027fefb8
commit 5fa743755d
4 changed files with 204 additions and 28 deletions

View File

@@ -763,6 +763,51 @@ export const action = {
async 'js-action-var-arg'(_effects, _input, testInput) {
assert(testInput == 42, "Input should be passed in");
return {
result: {
copyable: false,
message: "Done",
version: "0",
qr: false,
}
}
},
async 'test-rename'(effects, _input) {
await effects.writeFile({
volumeId: 'main',
path: 'test-rename.txt',
toWrite: 'Hello World',
});
await effects.rename({
srcVolume: 'main',
srcPath: 'test-rename.txt',
dstVolume: 'main',
dstPath: 'test-rename-2.txt',
});
const readIn = await effects.readFile({
volumeId: 'main',
path: 'test-rename-2.txt',
});
assert(readIn === 'Hello World', "Contents should be the same");
await effects.removeFile({
path: "test-rename-2.txt",
volumeId: "main",
});
try{
await effects.removeFile({
path: "test-rename.txt",
volumeId: "main",
});
assert(false, "Should not be able to remove file that doesn't exist");
}
catch (_){}
return {
result: {
copyable: false,