mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user