Skip to content

Commit

Permalink
feat: add test methods for the newly added method to delete directori…
Browse files Browse the repository at this point in the history
…es from templates.
  • Loading branch information
GiantTreeLP committed Oct 2, 2023
1 parent a07bec0 commit bcfc6d9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,15 @@ void testTemplateDelete() {
Assertions.assertFalse(storage.contains(TEMPLATE));
Assertions.assertFalse(storage.hasFile(TEMPLATE, "test.txt"));
}

@Test
@Order(120)
void testDeleteDirectory() {
var directory = "hello";
Assertions.assertTrue(storage.createDirectory(TEMPLATE, directory));
Assertions.assertTrue(storage.createFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.hasFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.deleteDirectory(TEMPLATE, directory));
Assertions.assertFalse(storage.hasFile(TEMPLATE, directory + "/test.txt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ public boolean deleteFile(@NonNull ServiceTemplate template, @NonNull String pat
public boolean deleteDirectory(@NonNull ServiceTemplate template, @NonNull String path) {
return this.executeWithClient(client -> {
this.deleteDir(client, this.constructRemotePath(template, path));
client.rmdir(this.constructRemotePath(template, path));
return true;
}, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,15 @@ void testTemplateDelete() {
Assertions.assertFalse(storage.contains(TEMPLATE));
Assertions.assertFalse(storage.hasFile(TEMPLATE, "test.txt"));
}

@Test
@Order(120)
void testDeleteDirectory() {
var directory = "hello";
Assertions.assertTrue(storage.createDirectory(TEMPLATE, directory));
Assertions.assertTrue(storage.createFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.hasFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.deleteDirectory(TEMPLATE, directory));
Assertions.assertFalse(storage.hasFile(TEMPLATE, directory + "/test.txt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,15 @@ void testTemplateDelete() {
Assertions.assertFalse(storage.contains(TEMPLATE));
Assertions.assertFalse(storage.hasFile(TEMPLATE, "test.txt"));
}

@Test
@Order(120)
void testDeleteDirectory() {
var directory = "hello";
Assertions.assertTrue(storage.createDirectory(TEMPLATE, directory));
Assertions.assertTrue(storage.createFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.hasFile(TEMPLATE, directory + "/test.txt"));
Assertions.assertTrue(storage.deleteDirectory(TEMPLATE, directory));
Assertions.assertFalse(storage.hasFile(TEMPLATE, directory + "/test.txt"));
}
}

0 comments on commit bcfc6d9

Please sign in to comment.